CMyButton dont't changing font

Posted on 2003-02-23
Medium Priority
Last Modified: 2013-12-03
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.
Question by:Rasim
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 23

Expert Comment

by:Roshan Davis
ID: 8006429
In your CMyButton's OnPaint function use

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

and use draw text.

Good Luck
LVL 31

Accepted Solution

Zoppo earned 200 total points
ID: 8008820
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,


Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month9 days, 6 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question