CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2019
    Posts
    82

    Bolding a Font of Groupbox heading/label in CDialog

    How to bold a font of groupbox heading/label in CDialog.I tried below code but it didn't worked.
    Code:
    CWnd * pwnd = GetDlgItem(IDC_GROUPBOX);
    CFont * pfont = pwnd->GetFont();
    LOGFONT lf; pfont->GetLogFont(&lf);
    lf.lfItalic = TRUE;         //To Make Text Italic
    lf.lfWeight = 500;          //To Make BOLD, Use FW_SEMIBOLD,FW_BOLD,FW_EXTRABOLD,FW_BLACK
    lf.lfUnderline = TRUE;      //Underline Text
    pfont->CreateFontIndirect(&lf);
    pwnd->SetFont(pfont);

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Bolding a Font of Groupbox heading/label in CDialog

    Victor Nijegorodov

  3. #3
    Join Date
    Oct 2019
    Posts
    82

    Re: Bolding a Font of Groupbox heading/label in CDialog

    I tried exactly same but nothing is reflecting

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Bolding a Font of Groupbox heading/label in CDialog

    Did you create a CFont member variable?
    5. Put a CFont object in your parent window, so it will exist for the entire lifetime of the child window.
    6. Initialize the CFont: m_font.CreateFontIndirect(&lf);
    7. Set the font into the static text window: pwnd->SetFont(&m_font);
    Victor Nijegorodov

  5. #5
    Join Date
    Oct 2019
    Posts
    82

    Re: Bolding a Font of Groupbox heading/label in CDialog

    I tried the exact code that i have written in my first thread

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Bolding a Font of Groupbox heading/label in CDialog

    Quote Originally Posted by Beginner_MFC View Post
    I tried the exact code that i have written in my first thread
    du you see the difference between your code from your OP and
    Quote Originally Posted by VictorN View Post
    Did you create a CFont member variable?
    5. Put a CFont object in your parent window, so it will exist for the entire lifetime of the child window.
    6. Initialize the CFont: m_font.CreateFontIndirect(&lf);
    7. Set the font into the static text window: pwnd->SetFont(&m_font);
    Victor Nijegorodov

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured