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. C / C++ / MFC
  3. How To: Bold the Text on the Property Page Tab when the page is active

How To: Bold the Text on the Property Page Tab when the page is active

Scheduled Pinned Locked Moved C / C++ / MFC
2 Posts 2 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.
  • L Offline
    L Offline
    Lori
    wrote on last edited by
    #1

    Hi, I need to Bold the text on the property page tab when the page is active. I have been successful in setting all the tabs to bold with the following Code: BOOL CPropSheet::OnInitDialog() { BOOL bResult = CPropertySheet::OnInitDialog(); // Set the attributes of the font. LOGFONT logFont; memset(&logFont, 0, sizeof(LOGFONT)); logFont.lfWeight = FW_BOLD; // create the new font. CFont font; font.CreateFontIndirect(&logFont); // set the control to use the new font. CTabCtrl* pTabCtrl = GetTabControl(); pTabCtrl->SetFont(&font); return bResult; } I have placed the code in the OnSetActive() event for the Pages but I can't seem to get the handle to the sheet to use the GetTabControl() function. If anyone has any ideas on how to do this or can provide a sample application it would be greatly appreciated. TIA, Lori

    M 1 Reply Last reply
    0
    • L Lori

      Hi, I need to Bold the text on the property page tab when the page is active. I have been successful in setting all the tabs to bold with the following Code: BOOL CPropSheet::OnInitDialog() { BOOL bResult = CPropertySheet::OnInitDialog(); // Set the attributes of the font. LOGFONT logFont; memset(&logFont, 0, sizeof(LOGFONT)); logFont.lfWeight = FW_BOLD; // create the new font. CFont font; font.CreateFontIndirect(&logFont); // set the control to use the new font. CTabCtrl* pTabCtrl = GetTabControl(); pTabCtrl->SetFont(&font); return bResult; } I have placed the code in the OnSetActive() event for the Pages but I can't seem to get the handle to the sheet to use the GetTabControl() function. If anyone has any ideas on how to do this or can provide a sample application it would be greatly appreciated. TIA, Lori

      M Offline
      M Offline
      Mike Dunn
      wrote on last edited by
      #2

      From any of the pages, you can get a pointer to the sheet with: CPropSheet* pSheet = (CPropSheet*) GetParent(); However your code has another bug. You have the font variable on the stack, so as soon as the function returns, font gets destroyed, taking the GDI font object with it. Make the CFont variable a member variable of the sheet so it will be available for the lifetime of the sheet.

      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