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. Increase the Font of a Static Controls in DialogBox Controls

Increase the Font of a Static Controls in DialogBox Controls

Scheduled Pinned Locked Moved C / C++ / MFC
4 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.
  • K Offline
    K Offline
    kiran janaswamy
    wrote on last edited by
    #1

    hi all, i want to Increase the Font of the Labels before all the Controls. is there any approach to increase the Font of a Static Control that we palce before all the Controls to Identify. i want to increase the Font Size of the Static Controls before the placed before the Controls in a Dialog Box. please let me know, uday. uday kiran

    D H 2 Replies Last reply
    0
    • K kiran janaswamy

      hi all, i want to Increase the Font of the Labels before all the Controls. is there any approach to increase the Font of a Static Control that we palce before all the Controls to Identify. i want to increase the Font Size of the Static Controls before the placed before the Controls in a Dialog Box. please let me know, uday. uday kiran

      D Offline
      D Offline
      Dy
      wrote on last edited by
      #2

      kiran janaswamy wrote:

      i want to Increase the Font of the Labels

      In the definition of your dialog (the .h file), include a CFont object (m_font). Initialise that font object in your constructor:

      // example only, use the large font you're after:
      LOGFONT lf;
      NONCLIENTMETRICS ncm;

      ncm.cbSize = sizeof(ncm);
      VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0));
      memcpy(&lf, &ncm.lfMessageFont, sizeof(LOGFONT));
      m_font.CreateFontIndirect(&lf);

      Then in your OnInitDialog, get the CStatic object for the ontrol, and set it's font. Remember, you need to have named the object in the resources something other then IDC_STATIC.

      CWnd *wnd = GetDlgItem(IDC_YOURCTRL);
      ASSERT(wnd);
      if (wnd) wnd->SetFont(&m_font);

      kiran janaswamy wrote:

      before all the Controls.

      Sorry, I don't understand what it is you're after with this bit.


      - Dy

      1 Reply Last reply
      0
      • K kiran janaswamy

        hi all, i want to Increase the Font of the Labels before all the Controls. is there any approach to increase the Font of a Static Control that we palce before all the Controls to Identify. i want to increase the Font Size of the Static Controls before the placed before the Controls in a Dialog Box. please let me know, uday. uday kiran

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

        use createfont and then SetFont

        K 1 Reply Last reply
        0
        • H Hamid Taebi

          use createfont and then SetFont

          K Offline
          K Offline
          kiran janaswamy
          wrote on last edited by
          #4

          hi WhiteSky, i am very much thankfull to your suggestions. i got it. uday. uday kiran

          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