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学习的更多相关文章

  1. CFileDialog(文件夹对话框类)和CFontDialog(字体设置对话框类)的使用学习

    CFileDialog(文件夹对话框类) 主要用于文件的保存,另存,打开,关闭等功能 功能“另存为”的实现: void CTXTDlg::OnFileSaveas() { LPCTSTR szFilt ...

  2. 【MFC】MFC技巧学习 当做字典来查

    MFC技巧学习 摘自:http://www.cnblogs.com/leven20061001/archive/2012/10/17/2728023.html 1."属性页的添加:创建对话框 ...

  3. 从直播编程到直播教育:LiveEdu.tv开启多元化的在线学习直播时代

    2015年9月,一个叫Livecoding.tv的网站在互联网上引起了编程界的注意.缘于Pingwest品玩的一位编辑在上网时无意中发现了这个网站,并写了一篇文章<一个比直播睡觉更奇怪的网站:直 ...

  4. Angular2学习笔记(1)

    Angular2学习笔记(1) 1. 写在前面 之前基于Electron写过一个Markdown编辑器.就其功能而言,主要功能已经实现,一些小的不影响使用的功能由于时间关系还没有完成:但就代码而言,之 ...

  5. ABP入门系列(1)——学习Abp框架之实操演练

    作为.Net工地搬砖长工一名,一直致力于挖坑(Bug)填坑(Debug),但技术却不见长进.也曾热情于新技术的学习,憧憬过成为技术大拿.从前端到后端,从bootstrap到javascript,从py ...

  6. 消息队列——RabbitMQ学习笔记

    消息队列--RabbitMQ学习笔记 1. 写在前面 昨天简单学习了一个消息队列项目--RabbitMQ,今天趁热打铁,将学到的东西记录下来. 学习的资料主要是官网给出的6个基本的消息发送/接收模型, ...

  7. js学习笔记:webpack基础入门(一)

    之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...

  8. Unity3d学习 制作地形

    这周学习了如何在unity中制作地形,就是在一个Terrain的对象上盖几座小山,在山底种几棵树,那就讲一下如何完成上述内容. 1.在新键得项目的游戏的Hierarchy目录中新键一个Terrain对 ...

  9. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

随机推荐

  1. LightOj 1221 - Travel Company(spfa判负环)

    1221 - Travel Company PDF (English) Statistics problem=1221" style="color:rgb(79,107,114)& ...

  2. dubbo注冊zookepper奇妙IP_续

    原文章地址:http://blog.csdn.net/lele2426/article/details/39530409#4483369 后来server须要连接外网.配置DNS后又開始出现奇妙的IP ...

  3. 使用scrapy进行12306车票查询

    概述 通过12306的查询API进行查询某日火车票, 结果保存在csv文件中. 详细 代码下载:http://www.demodashi.com/demo/12623.html 一.环境搭建 1. 安 ...

  4. hybird和js交互退出

  5. 解决Jquery Ajax提交 服务器端接收中文乱码问题

    看到有朋友说到用post提交方式解决,我指定了methord="post",仍然解决不了, 说一下解决办法,客户端进行编码,服务器端解码, 客户端:var where = esca ...

  6. 采集音频和摄像头视频并实时H264编码及AAC编码

    转自:http://www.cnblogs.com/haibindev/archive/2011/11/10/2244442.html 0. 前言 我在前两篇文章中写了DirectShow捕获音视频然 ...

  7. 【转】打造自己的视频会议系统 GGMeeting(附送源码)

    原文地址:http://www.cnblogs.com/justnow/p/4487201.html 自从在博客园发布开源即时通信系统GG(QQ高仿版)以来,结识了很多做IM的朋友,然后我和我的伙伴们 ...

  8. 建立第一个wcf程序

    使用管理员权限启动vs (否者将导致ServiceHost开启失败 权限不足) 1.创建一个空的控制台程序 2.添加程序集引用 System.ServiceModel 3.写入一些代码 如下 usin ...

  9. C# Oracle.ManagedDataAccess 批量更新表数据

    这是我第一次发表博客.以前经常到博客园查找相关技术和代码,今天在写一段小程序时出现了问题, 但在网上没能找到理想的解决方法.故注册了博客园,想与新手分享(因为本人也不是什么高手). vb.net和C# ...

  10. php对二维数据进行排序

    PHP一维数组的排序可以用sort(),asort(),arsort()等函数,但是PHP二维数组的排序需要自定义. 方法一:(经验证,成功)   作用:对二维数组进行指定key排序 参数:$arr ...