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. Changing Text font size without changing window size

Changing Text font size without changing window size

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 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.
  • C Offline
    C Offline
    CNewbie
    wrote on last edited by
    #1

    I wanted to make some really large letters in my application but whenever I change the font size everything within the window becomes bigger, buttons, etc... Is there anyway to only change the letter font sizes only? Thanks

    M H 2 Replies Last reply
    0
    • C CNewbie

      I wanted to make some really large letters in my application but whenever I change the font size everything within the window becomes bigger, buttons, etc... Is there anyway to only change the letter font sizes only? Thanks

      M Offline
      M Offline
      Monty2
      wrote on last edited by
      #2

      If you change the font through Dialog Properties the dialog size will also be resized, Instead change the font of a window from within the code //put this in constructor

      LOGFONT lf;
      memset(&lf,0,sizeof(lf));
      lf.lfHeight = -14;
      lf.lfWeight = FW_BOLD;
      lf.lfUnderline = (BYTE)TRUE;
      _tcscpy(lf.lfFaceName,_T("Arial"));

      m_fontBig.CreateFontIndirect(&lf);

      Not set the font anywhere you like

      //m_targetWindow should be created by now otherwise this will ASSERT
      m_targetWindow.SetFont(&m_fontBig);


      C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

      1 Reply Last reply
      0
      • C CNewbie

        I wanted to make some really large letters in my application but whenever I change the font size everything within the window becomes bigger, buttons, etc... Is there anyway to only change the letter font sizes only? Thanks

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

        Hi for change font and font size you can use CreateFont and SelectFont

        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