更改所有者绘制的Cbutton的字体 [英] Change the font of a owner drawn Cbutton

查看:95
本文介绍了更改所有者绘制的Cbutton的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



谁能告诉我如何在MFC中设置所有者绘制的CButton的字体?我试过了,但是好像字体被设置了好几次?


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?


CFont Font; //Member Vaiable of the class.

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

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




我正在类的OnDrawItem内执行Font.CreatePointFont和SetFont.

你能告诉我这里出了什么问题吗?

谢谢




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

Can you please tell me whats going wrong here?

Thanks

推荐答案

您可能应该尝试在OnPaint事件中为按钮设置字体.
You should probably try setting the font in the OnPaint event for the button.


这篇关于更改所有者绘制的Cbutton的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆