📄 fontsettingdialog.cpp
字号:
// FontSettingDialog.cpp : implementation file
//
#include "stdafx.h"
#include "ColorEdit.h"
#include "FontSettingDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFontSettingDialog dialog
CFontSettingDialog::CFontSettingDialog(CWnd* pParent /*=NULL*/)
: CDialog(CFontSettingDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CFontSettingDialog)
m_ItemName = _T("");
//}}AFX_DATA_INIT
}
void CFontSettingDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFontSettingDialog)
//DDX_CBString(pDX, IDC_FontSetting, m_ItemName);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFontSettingDialog, CDialog)
//{{AFX_MSG_MAP(CFontSettingDialog)
ON_BN_CLICKED(IDC_SelectFont, OnSelectFont)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFontSettingDialog message handlers
void CFontSettingDialog::OnSelectFont()
{
// TODO: Add your control notification handler code here
CFontDialog dlg;
// CFont *ft;
LOGFONT ret;
CString FaceName;
long Height; CString str1;
long Weight; CString str2;
long Width ; CString str3;
int Italic; CString str4;
int Underline; CString str5;
int Strikeout; CString str6;
int Quality; CString str7;
CString str, str8, str9="End";
if(dlg.DoModal()==IDOK)
{
char pbuf[100]; ///Auxiliary
dlg.GetCurrentFont(&ret);
FaceName= ret.lfFaceName;
Height =ret.lfHeight;
Weight =ret.lfWeight;
Width =ret.lfWidth;
Italic =ret.lfItalic;
Underline=ret.lfUnderline;
Strikeout=ret.lfStrikeOut;
Quality=ret.lfQuality;
str1="Height:" + (CString)itoa(Height,pbuf,10);
str2="\tWeight:" + (CString)itoa(Weight,pbuf,10);
str3="\tWidth:" + (CString)itoa(Width,pbuf,10);
str4="\tItalic:" + (CString)itoa(Italic,pbuf,10);
str5="\tUnderline:" + (CString)itoa(Underline,pbuf,10);
str6="\tStrikeout:" + (CString)itoa(Strikeout,pbuf,10);
str7="\tQuality:" + (CString)itoa(Quality,pbuf,10);
str8="\tFaceName:" + FaceName;
str9="\tEnd ^_^";
str = str1 + str2 + str3 + str4 + str5 + str6 + str7 + str8 + str9;
CFile myfile;
myfile.Open("fontdefine.txt",CFile::modeWrite|CFile::modeCreate);
myfile.Write(str, str.GetLength());
myfile.Close();
}
}
void CFontSettingDialog::OnOK()
{
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -