Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Change the Font Dynamically on button control

How to Change the Font Dynamically on button control

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    phanindra varma
    wrote on last edited by
    #1

    hi, I am developing SDI application ,inherits from FomView. It is required that i have to use TTF font type(which i downloaded from Ineternet) on button in run time. Thank u....

    H S 2 Replies Last reply
    0
    • P phanindra varma

      hi, I am developing SDI application ,inherits from FomView. It is required that i have to use TTF font type(which i downloaded from Ineternet) on button in run time. Thank u....

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      You can use of CFont::Create and use of SetFont.

      1 Reply Last reply
      0
      • P phanindra varma

        hi, I am developing SDI application ,inherits from FomView. It is required that i have to use TTF font type(which i downloaded from Ineternet) on button in run time. Thank u....

        S Offline
        S Offline
        softwero
        wrote on last edited by
        #3

        Mira wey, necesitas poner: CMyView : public CFormView{ CFont fontButton; // }; CMyView::OnInitialUpdate(){ LOGFONT lf; memset(&lf,0,sizeof(lf)); lf.lfHeight=(int)(33); lf.lfWeight=FW_BOLD; strcpy(lf.lfFaceName,"Arial"); m_fontButton.CreateFontIndirect(&lf); GetDlgItem(IDC_MYBUTTON)->SetFont(&fontButton); }

        P 1 Reply Last reply
        0
        • S softwero

          Mira wey, necesitas poner: CMyView : public CFormView{ CFont fontButton; // }; CMyView::OnInitialUpdate(){ LOGFONT lf; memset(&lf,0,sizeof(lf)); lf.lfHeight=(int)(33); lf.lfWeight=FW_BOLD; strcpy(lf.lfFaceName,"Arial"); m_fontButton.CreateFontIndirect(&lf); GetDlgItem(IDC_MYBUTTON)->SetFont(&fontButton); }

          P Offline
          P Offline
          phanindra varma
          wrote on last edited by
          #4

          hi.. Thanks for Reply.. But when i try to do the same but "AkruthiDev1"(ttf font for Hindi)inplace of "Arial".. the code doesn't work.. In some aticle ,they mention that we have to use EnumFontProc() callback function. Can u please tell me ,how to use that function.

          S 1 Reply Last reply
          0
          • P phanindra varma

            hi.. Thanks for Reply.. But when i try to do the same but "AkruthiDev1"(ttf font for Hindi)inplace of "Arial".. the code doesn't work.. In some aticle ,they mention that we have to use EnumFontProc() callback function. Can u please tell me ,how to use that function.

            S Offline
            S Offline
            softwero
            wrote on last edited by
            #5

            nop. You Need Install the Font, copy the file .ttf to C:windows/Fonts or $system$/Fonts Open ControlPanel->fontS go to menu File->Install New Font Choice your file .ttf for intall in windows

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups