Click here to Skip to main content
15,904,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

Can anyone tell me how to set the font of a owner drawn CButton in MFC? I tried this but it looks like the font is being set several times?


MIDL
CFont Font; //Member Vaiable of the class.

Font.CreatePointFont(120, _T("Courier"));        // creates a 12-point-Courier-font

            GetDlgItem(drawItem->CtlID)->SetFont(&Font);         // 



I am doing the Font.CreatePointFont and SetFont inside OnDrawItem of the class.

Can you please tell me whats going wrong here?

Thanks
Posted

1 solution

You should probably try setting the font in the OnPaint event for the button.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900