richeditctrlex.cpp
资源名称:1731.rar [点击查看]
上传用户:swkcbjrc
上传日期:2016-04-02
资源大小:45277k
文件大小:2k
源码类别:
游戏
开发平台:
Visual C++
- // richeditctrlex.cpp : implementation file
- //
- #include "stdafx.h"
- #include "..gamehigh.h"
- #include "..includericheditctrlex.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;
- }