⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 colorrichedit.cpp

📁 一个非常好的词法分析程序,加上语法的分析是一个难得一见的好实例
💻 CPP
字号:
// ColorEdit.cpp : implementation file
//

#include "stdafx.h"
#include "ColorRichEdit.h"
#include "MainFrm.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_RBUTTONUP()
	ON_COMMAND(IDM_CLEAR, OnClear)
	ON_COMMAND(IDM_HIDE_OUTBAR, OnHideOutbar)
	//}}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; 
}

BOOL CColorRichEdit::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	return CRichEditCtrl::OnCommand(wParam, lParam);
}

void CColorRichEdit::OnRButtonUp(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	BCMenu *menuPopup;
	BCMenu menu;

	menu.LoadMenu(IDR_MENU_OUTBAR);
	menuPopup=(BCMenu*)menu.GetSubMenu(0);

	ClientToScreen(&point);
	menuPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,point.x,point.y,this);
	menuPopup->DestroyMenu();
}

void CColorRichEdit::OnClear() 
{
	// TODO: Add your command handler code here
	SetWindowText("");
}

void CColorRichEdit::OnHideOutbar() 
{
	// TODO: Add your command handler code here
	CMainFrame* pMainFrame=((CMainFrame*)::AfxGetMainWnd());

	pMainFrame->ShowControlBar(pMainFrame->GetOutBar(),0,1);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -