如何修改CEdit Control的字体? [英] how to change font of CEdit Control?

查看:109
本文介绍了如何修改CEdit Control的字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。

首先抱歉我的英语不好。

即时尝试使用Setfont()函数更改CEdit控件的字体,但它不适用于我这里是我的代码:

hi.
first of all sorry for my bad english.
im trying to change font of a CEdit Control using of Setfont() function but its not working for me here is my code:

void CCustomView::OnInitialUpdate(){

CView::OnInitialUpdate();
CFont font;
font.CreateFontW(14,0,0,0,500,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS
		   ,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,_T("Arial"));
CmyEdit* myEdit = new CmyEdit;

myEdit->Create( WS_CHILD|WS_VISIBLE,GetCurrentNodeRect(),this,1);


myEdit->SetFont( &font );
}





CCustom View是CView的子类。



我是如此新鲜的mfc.plz详细解释。



最好的问候



CCustom View is a CView subclass.

im so fresh in mfc.plz explain in details.

best regards

推荐答案

一个对象将在它失效后被摧毁。所以你应该使用一个对象点。



An object will be destoried after it works down. So you should use a point of object.

CFont *m_pFont = new CFont;
m_pFont->CreateFont(...);
myEdit->SetFont(m_pFont);


这篇关于如何修改CEdit Control的字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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