Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - SetFont(BOLD or UNDERLINE)
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SetFont(BOLD or UNDERLINE)

 Post Reply Post Reply
Author
Message
jwhagen View Drop Down
Groupie
Groupie
Avatar

Joined: 09 May 2003
Location: United States
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote jwhagen Quote  Post ReplyReply Direct Link To This Post Topic: SetFont(BOLD or UNDERLINE)
    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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jwhagen View Drop Down
Groupie
Groupie
Avatar

Joined: 09 May 2003
Location: United States
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote jwhagen Quote  Post ReplyReply Direct Link To This Post 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



Edited by jwhagen
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jwhagen View Drop Down
Groupie
Groupie
Avatar

Joined: 09 May 2003
Location: United States
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote jwhagen Quote  Post ReplyReply Direct Link To This Post 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



Edited by jwhagen
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.