Print Page | Close Window

SetFont(BOLD or UNDERLINE)

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2138
Printed Date: 29 May 2025 at 4:36am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SetFont(BOLD or UNDERLINE)
Posted By: jwhagen
Subject: SetFont(BOLD or UNDERLINE)
Date Posted: 21 April 2005 at 7:57am

I'm trying to set the Title to be in BOLD font and UNDERLINED but don't know how to make this work. I can get one or the other, but not both. Any help would be appreciated!

 // set the title text to bold font.
 m_Title.SetFont( &XTAuxData().fontBold );
 m_Title.SetFont( &XTAuxData().fontULine );

In the instance above, whatever line is last is the one that works. In this example, the font is does not display as BOLD, but only UNDERLINED. Can they be ORd together? If so, how?

John Hagen




Replies:
Posted By: Oleg
Date Posted: 21 April 2005 at 11:17pm

You must create new font

NONCLIENTMETRICS ncm = { sizeof(NONCLIENTMETRICS) };

VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0));

ncm.lfSmCaptionFont.lfWeight = FW_BOLD;

ncm.lfSmCaptionFont.lfUnderline = 1;

 

font.CreateFontIndirect(&ncm.lfSmCaptionFont);



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jwhagen
Date Posted: 23 April 2005 at 1:41pm

Hi Oleg,

Thanks for your quick response! I tried what you suggested and I was still unable to have the title underlined AND in bold. This is what I used in the ListCtrl_vc60 sample program, in the AboutDlg.h file:

CFont myFont;
NONCLIENTMETRICS ncm = { sizeof(NONCLIENTMETRICS) };
VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0));
ncm.lfSmCaptionFont.lfWeight = FW_BOLD;
ncm.lfSmCaptionFont.lfUnderline = 1;
myFont.CreateFontIndirect(&ncm.lfSmCaptionFont);

then...

#ifdef _XTP_INCLUDE_CONTROLS
  // set the title text to bold font.
  m_txtTitle.SetFont( &myFont );
  //  m_txtTitle.SetFont( &XTAuxData().fontBold );
...

All I get is the new font in bold, without the underline. Suggestions?

John Hagen



Posted By: Oleg
Date Posted: 25 April 2005 at 11:10pm

I create new sample and it works.

Check if myFont  is member of CAboutDlg.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jwhagen
Date Posted: 26 April 2005 at 6:47am

   Hi Oleg,

You were correct. I did not have myFont as a member of CAboutDlg. Thanks for setting me straight. It now works great!

John




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net