📄 baseedit.cpp
字号:
// BaseEdit.cpp : implementation file
//
#include "stdafx.h"
#include "Rsglxt.h"
#include "BaseEdit.h"
//#include "RxGrid.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBaseEdit
CBaseEdit::CBaseEdit()
{
}
CBaseEdit::~CBaseEdit()
{
}
BEGIN_MESSAGE_MAP(CBaseEdit, CEdit)
//{{AFX_MSG_MAP(CBaseEdit)
ON_WM_CTLCOLOR_REFLECT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBaseEdit message handlers
BOOL CBaseEdit::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(m_bOnly==true)
{
if(pMsg->message==WM_KEYDOWN&&((pMsg->wParam<48||pMsg->wParam>57)&&pMsg->wParam!=8&&pMsg->wParam!=8&&pMsg->wParam!=38&&pMsg->wParam!=40&&pMsg->wParam!=13&&pMsg->wParam!=VK_ESCAPE))
if((pMsg->wParam<VK_NUMPAD0||pMsg->wParam>VK_NUMPAD9))
{
pMsg->wParam=VK_CONTROL ;
return true;
}
}
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==13)
pMsg->wParam=9;
return CEdit::PreTranslateMessage(pMsg);
}
void CBaseEdit::NumberOnly(bool bOnly)
{
m_bOnly=bOnly;
}
HBRUSH CBaseEdit::CtlColor(CDC* pDC, UINT nCtlColor)
{
// TODO: Change any attributes of the DC here
CDC* dc = GetDC(); //获取画布对象
CRect rect;
GetClientRect(rect); //获取客户区域
rect.InflateRect(1,1,1,1);//将客户区域增大一个像素
CBrush brush (m_Colour);//创建画刷
dc->FrameRect(rect,&brush);//绘制边框
// TODO: Return a non-NULL brush if the parent's handler should not be called
return NULL;
}
void CBaseEdit::SetColour(COLORREF Colour)
{
m_Colour = Colour;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -