📄 word.cpp
字号:
// Word.cpp : implementation file
//
#include "stdafx.h"
#include "direction2.h"
#include "Word.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWord dialog
CWord::CWord(CWnd* pParent /*=NULL*/)
: CDialog(CWord::IDD, pParent)
{
//{{AFX_DATA_INIT(CWord)
m_Word = _T("");
//}}AFX_DATA_INIT
m_pParentWnd=pParent;
m_textcolor=RGB(0,0,0);
//字体式样字体大小
m_text.lfHeight = 17;
m_text.lfWidth = 0;
m_text.lfEscapement=0;
m_text.lfOrientation =0;
m_text.lfWeight = FW_NORMAL;
m_text.lfItalic = FALSE;
m_text.lfUnderline = FALSE;
m_text.lfStrikeOut = FALSE;
m_text.lfCharSet= GB2312_CHARSET;
m_text.lfOutPrecision = OUT_STROKE_PRECIS;
m_text.lfClipPrecision = CLIP_STROKE_PRECIS;
m_text.lfQuality = DRAFT_QUALITY;
m_text.lfPitchAndFamily = VARIABLE_PITCH|FF_MODERN;
strcpy(m_text.lfFaceName,"仿宋_GB2312" );
}
void CWord::SetText(CString word, COLORREF textcolor, LOGFONT text,CPoint textpoint)
{
m_Word=word;
m_textcolor=textcolor;
m_text=text;
m_textpoint=textpoint;
this->UpdateData(false); //更新窗口的数据显示
}
void CWord::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CWord)
DDX_Text(pDX, IDC_EDIT1, m_Word);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CWord, CDialog)
//{{AFX_MSG_MAP(CWord)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWord message handlers
void CWord::OnOK()
{
// TODO: Add extra validation here
this->UpdateData(true);
m_pParentWnd->SendMessage(WM_TEXT_CHANGE,0,1); //通过此消息告诉父窗口矩形的属性已经改变
CDialog::OnOK();
}
void CWord::OnButton1()
{
// TODO: Add your control notification handler code here
//字体设计
CFontDialog dlg;
dlg.m_cf.lpLogFont =&m_text;
dlg.m_cf.rgbColors=m_textcolor;
dlg.m_cf.Flags|=CF_INITTOLOGFONTSTRUCT; //设置标志
if(dlg.DoModal() == IDOK)
{
dlg.GetCurrentFont(&m_text);
m_textcolor = dlg.GetColor();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -