numberedit.cpp
来自「用Visual c++实现汽配件管理系统」· C++ 代码 · 共 48 行
CPP
48 行
// NumberEdit.cpp : implementation file
//
#include "stdafx.h"
#include "qpglxt.h"
#include "NumberEdit.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CNumberEdit
CNumberEdit::CNumberEdit()
{
}
CNumberEdit::~CNumberEdit()
{
}
BEGIN_MESSAGE_MAP(CNumberEdit, CEdit)
//{{AFX_MSG_MAP(CNumberEdit)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNumberEdit message handlers
BOOL CNumberEdit::PreTranslateMessage(MSG* pMsg)
{
//如果输入的字符不是1~9或“.”或其它功能键
if(pMsg->message==WM_KEYDOWN )
{ if((pMsg->wParam<0x30 || pMsg->wParam>0x39) && pMsg->wParam!=190 && pMsg->wParam!=8 && pMsg->wParam!=13)
if(pMsg->wParam<VK_NUMPAD0 || pMsg->wParam>VK_NUMPAD9)// &&&& pMsg->wParam!=VK_PERIOD
pMsg->wParam=VK_CONTROL;
if( pMsg->wParam==13)
pMsg->wParam=9;
}
return CEdit::PreTranslateMessage(pMsg);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?