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. javascript-使用el表达式获取后台传递的数据

      js获取后台数据 CreateTime--2017年5月26日16:14:14Author:Marydon 在js中使用el表达式的前提是:HTML引用js使用内联方式(即在JSP页面内部使用js ...

  2. 08-hibernate注解-总结

    直接贴过来了: 1, 2,

  3. git 教程一

    git 是一个开源的分布式版本控件系统,用于敏捷高效地处理任何或小或大的项目. Git是Linus Torvalds为了帮助管理Linux内核开发而开发的一个开放源码的版本控制软件. Git 与常用 ...

  4. UIPopoverController具体解释

    今天一位童鞋问我个问题.大意是popoverController不会显示.经过我寻找问题发现以下这种方法不好掌控. 为什么说他不好掌控那.我这个给大家带来一个列子.通过这个列子来介绍PopoverCo ...

  5. ExtJS学习------Ext.define的继承extend,用javascript实现相似Ext的继承

    (1)Ext.define的继承extend 详细实例: Ext.onReady(function(){ //Sup Class 父类 Ext.define('Person',{ config:{ n ...

  6. App登录注册功能,怎样做到用户体验最佳?

    用户登录系统,可以细分为三项功能模块,分别是:登录.注册和密码找回.本文作者将结合自身经历,谈谈他在做这块的时候一些想法,主要是涉及业务流程. 登录和注册功能,不论是PC端还是移动端,大多数产品都会涉 ...

  7. unity调用系统剪切板功能

    package com.game.utils; import android.app.Activity; import android.content.ClipData; import android ...

  8. DB2字符处理函数

    转自:http://www.blogjava.net/bingle/archive/2007/07/11/129681.html ----------------------------------- ...

  9. Http basic Auth 认证方式帮助类

    BasicAuthenticationUtil import java.io.IOException; import java.security.MessageDigest; import javax ...

  10. 安装gstreamer开发环境

    ubuntu中安装gstreamer开发环境: * 安装gstreamer基本库,工具,以及插件 sudo apt--dev gstreamer-tools gstreamer0.-tools gst ...