📄 richeditctrlex.cpp
字号:
// richeditctrlex.cpp : implementation file
//
#include "stdafx.h"
#include "..\gamehigh.h"
#include "..\include\richeditctrlex.h"
#include "macros.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRichEditCtrlEx
CRichEditCtrlEx::CRichEditCtrlEx()
{
}
CRichEditCtrlEx::~CRichEditCtrlEx()
{
}
BEGIN_MESSAGE_MAP(CRichEditCtrlEx, CRichEditCtrl)
//{{AFX_MSG_MAP(CRichEditCtrlEx)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRichEditCtrlEx message handlers
BOOL CRichEditCtrlEx::AppendText(LPCTSTR lpszText, COLORREF clrText)
{
ASSERT(lpszText);
if(NULL == lpszText ||
0 == strlen(lpszText))
{
return FALSE;
}
SAFE_CHECKWND(this)
{
CHARFORMAT CharFormat;
memset(&CharFormat,0,sizeof(CHARFORMAT));
CharFormat.cbSize=sizeof(CHARFORMAT);
CharFormat.dwMask=CFM_COLOR;
CharFormat.crTextColor=clrText;
this->SetWordCharFormat(CharFormat);
this->ReplaceSel(lpszText, FALSE);
}
return TRUE;
}
BOOL CRichEditCtrlEx::AppendText(LPCTSTR lpszText, int nHeight, COLORREF clrText)
{
ASSERT(lpszText);
if(NULL == lpszText ||
0 == strlen(lpszText))
{
return FALSE;
}
SAFE_CHECKWND(this)
{
CHARFORMAT CharFormat;
memset(&CharFormat,0,sizeof(CHARFORMAT));
CharFormat.cbSize =sizeof(CHARFORMAT);
CharFormat.dwMask =CFM_COLOR | CFM_SIZE;
CharFormat.crTextColor =clrText;
CharFormat.yHeight =nHeight;
this->SetWordCharFormat(CharFormat);
this->ReplaceSel(lpszText, FALSE);
}
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -