CFontDialog学习
void CMfcFontDlgDlg::OnBtnFont()
{
// Show the font dialog with all the default settings.
CFontDialog dlg;
dlg.DoModal();
} void CMfcFontDlgDlg::OnBtnFontSpecial()
{
// Show the font dialog with 12 point "Times New Roman" as the selected font.
LOGFONT lf;
memset(&lf, , sizeof(LOGFONT)); CClientDC dc(this);
lf.lfHeight = -MulDiv(, dc.GetDeviceCaps(LOGPIXELSY), );
strcpy(lf.lfFaceName, "Times New Roman"); CFontDialog dlg(&lf);
// The code fragment creates a font based on the information we got from CFontDialog::m_cf variable.
if (dlg.DoModal() == IDOK)
{
// Create the font using the selected font from CFontDialog.
LOGFONT lf;
memcpy(&lf, dlg.m_cf.lpLogFont, sizeof(LOGFONT)); CFont font;
VERIFY(font.CreateFontIndirect(&lf)); // Do something with the font just created...
CClientDC dc(this);
CFont* def_font = dc.SelectObject(&font);
dc.TextOut(, , "Hello", );
dc.SelectObject(def_font); // Done with the font. Delete the font object.
font.DeleteObject();
}
} void CMfcFontDlgDlg::OnBtnFontProperty()
{
// Get the characteristics
CFontDialog dlg;
if (dlg.DoModal() == IDOK)
{
// Get the characteristics of the currently selected font, if any.
LOGFONT lf;
dlg.GetCurrentFont(&lf);
TRACE("Face name of the selected font = %s\n", lf.lfFaceName);
// Get the face name of the selected font, if any.
CString facename = dlg.GetFaceName();
TRACE("Face name of the selected font = %s\n", facename);
// Get the style name of the selected font, if any.
CString stylename = dlg.GetStyleName();
TRACE("Style name of the selected font = %s\n", stylename);
// Get the size of the selected font, if any.
int size = dlg.GetSize();
TRACE("The size of the selected font = %d\n", size);
// Get the color of the selected font, if any.
COLORREF color = dlg.GetColor();
TRACE("Color of the selected font = %8x\n", color);
// Get the weight of the selected font, if any.
int weight = dlg.GetWeight();
TRACE("Weight of the selected font = %d\n", weight);
// Is the selected font displayed with strikeout?
BOOL strikeout = dlg.IsStrikeOut();
TRACE("Is the selected font displayed with strikeout? %d\n", strikeout);
// Is the selected font underlined?
BOOL underline = dlg.IsUnderline();
TRACE("Is the selected font underlined? %d\n", underline);
// Is the selected font bold?
BOOL bold = dlg.IsBold();
TRACE("Is the selected font bold? %d\n", bold);
// Is the selected font italic?
BOOL italic = dlg.IsItalic();
TRACE("Is the selected font italic? %d\n", italic);
}
}
CFontDialog学习的更多相关文章
- CFileDialog(文件夹对话框类)和CFontDialog(字体设置对话框类)的使用学习
CFileDialog(文件夹对话框类) 主要用于文件的保存,另存,打开,关闭等功能 功能“另存为”的实现: void CTXTDlg::OnFileSaveas() { LPCTSTR szFilt ...
- 【MFC】MFC技巧学习 当做字典来查
MFC技巧学习 摘自:http://www.cnblogs.com/leven20061001/archive/2012/10/17/2728023.html 1."属性页的添加:创建对话框 ...
- 从直播编程到直播教育:LiveEdu.tv开启多元化的在线学习直播时代
2015年9月,一个叫Livecoding.tv的网站在互联网上引起了编程界的注意.缘于Pingwest品玩的一位编辑在上网时无意中发现了这个网站,并写了一篇文章<一个比直播睡觉更奇怪的网站:直 ...
- Angular2学习笔记(1)
Angular2学习笔记(1) 1. 写在前面 之前基于Electron写过一个Markdown编辑器.就其功能而言,主要功能已经实现,一些小的不影响使用的功能由于时间关系还没有完成:但就代码而言,之 ...
- ABP入门系列(1)——学习Abp框架之实操演练
作为.Net工地搬砖长工一名,一直致力于挖坑(Bug)填坑(Debug),但技术却不见长进.也曾热情于新技术的学习,憧憬过成为技术大拿.从前端到后端,从bootstrap到javascript,从py ...
- 消息队列——RabbitMQ学习笔记
消息队列--RabbitMQ学习笔记 1. 写在前面 昨天简单学习了一个消息队列项目--RabbitMQ,今天趁热打铁,将学到的东西记录下来. 学习的资料主要是官网给出的6个基本的消息发送/接收模型, ...
- js学习笔记:webpack基础入门(一)
之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...
- Unity3d学习 制作地形
这周学习了如何在unity中制作地形,就是在一个Terrain的对象上盖几座小山,在山底种几棵树,那就讲一下如何完成上述内容. 1.在新键得项目的游戏的Hierarchy目录中新键一个Terrain对 ...
- 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...
随机推荐
- 关于android-support-v4.jar包的错误
1.加入android-support-v4 误 java.lang.ClassNotFoundException: android.support.v4.view.ViewPager in load ...
- web页面查看Tomcat服务器指标
在进行性能测试时,一般都需要对应用服务器进行监控,监控的指标包括应用服务器的JVM使用状况.可用连接数.队列长度等信息.商业的应用服务器如WebLogic.WebSphere等都提供了Console对 ...
- 解决grep的结果无法显示文件名的问题
有时候想在代码中执行某个关键词,会用下面的语句: find . -type f -name "*.java" | xargs grep -n "<keyword&g ...
- android源代码分析 android toast使用具体解释 toast自己定义
在安卓开发过程中.toast使我们常常使用的一个类.当我们须要向用户传达一些信息,可是不须要和用户交互时,该方式就是一种十分恰当的途径. 我们习惯了这样使用toast:Toast.makeText(C ...
- Navicat Premium如何打开SQL文件.MDF和.LDF文件
相信大家再装SQL Server时都会遇到一件很头疼的事情--装完SQL server之后发现没有启动程序.没有经验的会以为SQL SERVER安装失败了于是选择重装.可是呵呵,重装了4,5次还是一样 ...
- 关于UML图形/图示数量总结
http://www.uml.org/ 第一种说法: UML - Unified Modeling Language UML 共定义了9种图,包括4种结构图和5种形为图: //4种结构图: 类图 对象 ...
- js中加入数据缓存
因为我们的系统设计 所有的数据查询全部是采用参数化json 后台解析后进行数据返回 由于使用统一的数据查询入口 所有可以很方便的为数据设置缓存 var ModelDataCache = new Arr ...
- jsp版本的环境变量集合
System.out.println("Protocol: " + request.getProtocol());System.out.println("Scheme: ...
- 点滴积累【JS】---JS小功能(setInterval实现图片效果显示时间)
效果: 代码: <head runat="server"> <title></title> <script type="text ...
- oracle 查询前30条数据
select * from (select a.*,rownum as rn from tetm_ad_type a) b where b.rn<30 --表名不能用as 字段取别名,直 ...