• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

CMyButton dont't changing font

I derived class CMyButton from CButton and after it button became draw text with system, bold font.
When i am changing current font for button dc(dialog dc) it do nothing.
Only if i am making owner draw button it take affect,but in this case i need to draw entire button.
Did somebody meet this situation?
I will be thanking for answers.
1 Solution
Roshan DavisCommented:
In your CMyButton's OnPaint function use

CFont* pFont = GetParent()->GetFont();
select this font to paint dc

and use draw text.

Good Luck
Hi Rasim,

don't set any DC's font ... set the button's font, either
with SetFont() or by sending a WM_SETFONT message to the button, i.e.:

 CFont myFont;
 myFont.CreatePointFont( 120, "Times New Roman" );
 SetFont( &myFont );

hope that helps,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now