我才学,别见笑,显示文字要用到LOGFONT。能否不用CFontDialog初始化LOGFONT。在OnDraw()里,
可以pDC->GetCurrentFont()->GetLogFont(&lpLogFont)这样初始化,但在构造函数里为什么不行?谁能说详细些?谢谢!
可以pDC->GetCurrentFont()->GetLogFont(&lpLogFont)这样初始化,但在构造函数里为什么不行?谁能说详细些?谢谢!
解决方案 »
- 怎么获取IHTMLFrameBase接口?或者怎样获得frame的marging,先谢谢了
- 【求助】如何用VC++做一个简单的验证正则表达式的工具?
- error C2110: cannot add two pointers
- 请 tyjoe(天乐)来领分100!!!
- 简易浏览器制作源码或相关文档
- 请问CSocket类是不是只要缓冲区里面有数据,就会响应OnReceive函数啊?
- 网络考试监控怎么做啊?
- test
- 请问?.gbc是什么格式的文件?怎么打开?
- 第三次问此菜鸟问题!
- MFC可以以静态库方式连接那我自己做的DLL能不能静态连接(就是运行时不需要用这个DLL呢)谢谢
- 不用分割条,怎样把外来的View类加入到MainFrame中...
// select the font object into a DC (device context) for text
// drawing, and finally delete the font object.// Initializes a CFont object with the characteristics given
// in a LOGFONT structure.
CFont font;
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT)); // zero out structure
lf.lfHeight = 12; // request a 12-pixel-height font
strcpy(lf.lfFaceName, "Arial"); // request a face name "Arial"
VERIFY(font.CreateFontIndirect(&lf)); // create the font// Do something with the font just created...
CClientDC dc(this);
CFont* def_font = dc.SelectObject(&font);
dc.TextOut(5, 5, "Hello", 5);
dc.SelectObject(def_font);// Done with the font. Delete the font object.
font.DeleteObject();