📄 textinput.cpp
字号:
// textInput.cpp : implementation file
//
#include "stdafx.h"
#include "geditor.h"
#include "textInput.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// textInput dialog
textInput::textInput(CWnd* pParent /*=NULL*/)
: CDialog(textInput::IDD, pParent)
{
//{{AFX_DATA_INIT(textInput)
m_text = _T("");
//}}AFX_DATA_INIT
log.lfCharSet=ANSI_CHARSET; //字体字符集
log.lfClipPrecision=CLIP_DEFAULT_PRECIS; //剪贴板字符
log.lfEscapement=0; //角度
strcpy(log.lfFaceName,"Cyz Font"); //
log.lfHeight=-20;
log.lfItalic=0; //斜体度
log.lfOrientation=0;
log.lfOutPrecision=OUT_DEFAULT_PRECIS;
log.lfPitchAndFamily=VARIABLE_PITCH|FF_ROMAN; //字体间距和字体族
log.lfQuality=PROOF_QUALITY;
log.lfStrikeOut=0; //镂空字体
log.lfUnderline=0;
log.lfWeight=FW_NORMAL; //字体精细
log.lfWidth=0;
}
void textInput::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(textInput)
DDX_Text(pDX, IDC_INPUT, m_text);
DDV_MaxChars(pDX, m_text, 20);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(textInput, CDialog)
//{{AFX_MSG_MAP(textInput)
ON_BN_CLICKED(IDC_FONT, OnFont)
ON_EN_CHANGE(IDC_INPUT, OnChangeInput)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// textInput message handlers
void textInput::OnFont()
{
CFontDialog dlg;
if(dlg.DoModal()==IDOK)
{
dlg.GetCurrentFont(&log);
color=dlg.GetColor();
};
}
void textInput::OnChangeInput()
{
UpdateData();
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void textInput::OnOK()
{
if (m_text=="")
AfxMessageBox("Please Input String");
else
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -