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

📄 nonumedit.cpp

📁 这是书上的代码
💻 CPP
字号:
// NoNumEdit.cpp : implementation file
//

#include "stdafx.h"
#include "subclassing.h"
#include "NoNumEdit.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CNoNumEdit

CNoNumEdit::CNoNumEdit()
{
}

CNoNumEdit::~CNoNumEdit()
{
}


BEGIN_MESSAGE_MAP(CNoNumEdit, CEdit)
	//{{AFX_MSG_MAP(CNoNumEdit)
	ON_WM_CHAR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNoNumEdit message handlers

void CNoNumEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	// TODO: Add your message handler code here and/or call default
	TCHAR ch=nChar;
	if(ch>=_T('0')&&ch<=_T('9'))
	{
		AfxMessageBox(("请不要输入数字!"),MB_OK);
     //当输入数字字符时将被忽略,并显示警告信息
		return;
	}
	CEdit::OnChar(nChar, nRepCnt, nFlags);//输入为非数字字符时调用原处理函数
}

⌨️ 快捷键说明

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