改变对话框上某一个控件的字体和字体大小
2014-03-20 13:41
260 查看
CFont *pfont = m_TreeCtrl1.GetFont();
LOGFONT logfont;
pfont->GetLogFont(&logfont);
CFontDialog dlg(&logfont);
if(dlg.DoModal()==IDOK)
{
LOGFONT temp; //声明LOGFONT结构指针
dlg.GetCurrentFont(&temp); //获取当前字体信息
m_Font.DeleteObject();
m_Font.CreateFontIndirect(&temp); //直接创建字体;
m_TreeCtrl1.SetFont(&m_Font); //设置字体;
}
CFont m_font; //这个绝对不能使临时变量,否则会产生意外的错误
CMyDialog::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
m_font.DeleteObject();
}
LOGFONT logfont;
pfont->GetLogFont(&logfont);
CFontDialog dlg(&logfont);
if(dlg.DoModal()==IDOK)
{
LOGFONT temp; //声明LOGFONT结构指针
dlg.GetCurrentFont(&temp); //获取当前字体信息
m_Font.DeleteObject();
m_Font.CreateFontIndirect(&temp); //直接创建字体;
m_TreeCtrl1.SetFont(&m_Font); //设置字体;
}
CFont m_font; //这个绝对不能使临时变量,否则会产生意外的错误
CMyDialog::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
m_font.DeleteObject();
}
相关文章推荐
- 【android添加jar包】android添加jar包的方法
- sublime text build3059 破解
- 遍历目录结构生成JSON
- 设计模式之美:Creational Patterns(创建型模式)
- Razor视图引擎 语法学习(一)
- 子品牌最吃香:国产手机厂商大玩新花样
- 「我们就差一个写代码的了」为什么会招黑?
- python 从2.x-3.x一些变化
- castle windsor IOC
- UINavigationController详解与使用(三)ToolBar
- Linux下程序的编译链接及装载(解释)运行
- Oracle:只有rman备份(数据,参数,日志,控制文件全丢失)的恢复
- LeetCode Insert Interval
- 安卓开发第一个小程序HelloWorld
- 揭秘uc浏览器二
- L6050U compile erro
- 望着药鼎内翻腾的火焰
- 笔记本硬盘导入文件失败怎么恢复
- linux shell 脚本实现tcp/upd协议通讯(重定向应用)
- UINavigationController详解与使用(二)页面切换和segmentedCon...