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 ...
随机推荐
- 算法笔记_057:蓝桥杯练习 最大的算式 (Java)
目录 1 问题描述 2 解决方案 1 问题描述 问题描述 题目很简单,给出N个数字,不改变它们的相对位置,在中间加入K个乘号和N-K-1个加号,(括号随便加)使最终结果尽量大.因为乘号和加号一共就 ...
- 理解和使用 Promise.all 和 Promise.race
一.Pomise.all的使用 Promise.all可以将多个Promise实例包装成一个新的Promise实例.同时,成功和失败的返回值是不同的,成功的时候返回的是一个结果数组,而失败的时候则返回 ...
- 一直加载“fonts.googleapis.com”的解决办法
原文:http://www.tuicool.com/articles/6bayeq 最近国内对google又开始了新一轮的屏蔽,很多wordpress用户发现一个现象,那就是网站前台和后台打开都非常慢 ...
- 【BIEE】存储安装信息的目录
在BIEE中存在一个目录,用于存储BIEE的安装信息,这个文件的目录为 ~/Oracle_BI1/install/setupinfo.txt 我的目录为:E:/BIEE/Oracle_BI1/inst ...
- H5 Canvas | 画布中变量作用域与setInterval方法同步执行探究
Demo - 随机绘制圆环 实现思路: 将一个圆环的绘制分成100份,setInterval()方法定义每隔时间n绘制一段新的,每份的开始路径都是上一次的结束路径,实现步进绘制. 通过Math.ran ...
- java基础讲解02-----eclipse快捷方式(2017-04-12 23:47)
ctrl + shift+o 出去多余的引用包 ctrl+i 修改格式
- 征服 Ajax 应用程序的安全威胁
Ajax 构建于动态 HTML(DHTML)技术之上,其中包括如下这些最常见的技术: JavaScript :JavaScript 是一种脚本语言,在客户端 Web 应用程序中经常使用. 文档对象模型 ...
- SUSE11SP3--安装svn
SUSE上安装新版本的subversion是一件很麻烦的事情,涉及到的依赖太多,包括需要更新部分工具的版本. 为了以较小的代价安装subversion,我决定在SUSE11下安装 subversion ...
- MVC3 模板页页预留Section
一.模板页 Razor出现后我们就可以选择不再使用asp.net master 模板页.取而代之的是cshtml razor的模板文件.用法个人认为还是和master模板页类似.但在mater模板页的 ...
- js获取网页宽高
<script> function getInfo() { var s = ""; s += " 网页可见区域宽:"+ document.body. ...