📄 colorrichedit.cpp
字号:
// ColorEdit.cpp : implementation file
//
#include "stdafx.h"
#include "ColorRichEdit.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CColorRichEdit
CColorRichEdit::CColorRichEdit()
{
}
CColorRichEdit::~CColorRichEdit()
{
}
BEGIN_MESSAGE_MAP(CColorRichEdit, CRichEditCtrl)
//{{AFX_MSG_MAP(CColorRichEdit)
ON_WM_CTLCOLOR_REFLECT()
ON_WM_RBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CColorRichEdit message handlers
HBRUSH CColorRichEdit::CtlColor(CDC* pDC, UINT nCtlColor)
{
// TODO: Change any attributes of the DC here
COLORREF clrBack=RGB(0,0,0);
COLORREF clrText=RGB(0,255,0);
pDC->SetTextColor(clrText);
pDC->SetBkColor(clrBack);
m_bkBrush = ::CreateSolidBrush(clrBack);
// TODO: Return a non-NULL brush if the parent's handler should not be called
return m_bkBrush;
}
void CColorRichEdit::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
GetCursorPos(&point);
CMenu menu;
VERIFY(menu.LoadMenu(IDR_MENU_OUTBAR));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
CWnd* pWndPopupOwner = this;
while (pWndPopupOwner->GetStyle() & WS_CHILD)
pWndPopupOwner = pWndPopupOwner->GetParent();
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,pWndPopupOwner);
CRichEditCtrl::OnRButtonDown(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -