dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Changing Text Size on a Form

  1. #1

    Changing Text Size on a Form

    Does anyone know how to change the font and the font size of the static text on a form. I also want to make it bold and italics. Please help !!

  2. #2
    Join Date
    May 1999
    Location
    DELAWARE, USA
    Posts
    9,917
    Declare CFont member in a header file and change ID of static control to something other than IDC_STATIC. Also declare SetStaticFont if you want.
    Call this function from OnInitDialog or copy directly;
    Code:
    void CSomeDlg::SetStaticFont(void)
    {
      LOGFONT lf;
      CWnd* pWnd = GetDlgItem(IDC_STATIC_TEXT);
    
      CFont* pFont = GetFont();
      pFont->GetLogFont(&lf);
      lf.lfWeight = FW_BOLD;
      lf.lfHeight -= 5;
      m_Font.CreateFontIndirect(&lf);
      pWnd->SetFont(&m_Font);
    
    }
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)