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

📄 numberedit.cpp

📁 办公助手的主窗体由计算器和便利贴两个子窗体和6个办公助手
💻 CPP
字号:
// NumberEdit.cpp : implementation file
//

#include "stdafx.h"
#include "Practical.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)
	ON_WM_CHAR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNumberEdit message handlers

void CNumberEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	// TODO: Add your message handler code here and/or call default
	if(nChar == 8 || nChar == 46) //退格键 || nChar == 45
	{
		CString str;
		GetWindowText(str);
		if(str.Find(".",0)==-1)
			CEdit::OnChar(nChar, nRepCnt, nFlags);
		else
			nChar = 0;
		return;
	}
	if(nChar<48 || nChar>57) //允许输入数字
		nChar = 0;
	else
		CEdit::OnChar(nChar, nRepCnt, nFlags);
}

⌨️ 快捷键说明

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