只能输入+ 0 1 2 3 4 5 6 7 8 9这几个字符,按其他键不响应
解决方案 »
- 是用char*[] 数组做形参的困惑,那位大侠能给解释一下,谢啦~
- 一个使用unicode的工程,怎么把LPVOID转化为CString?
- 请教大家一个菜鸟的问题,热心的朋友进来看看!
- 编译时说函数重定义,但注释后又说没有定义,好郁闷!
- ACTIVEX控件截屏后出现“获取剪贴板数据错误”问题
- 关于 非模态对话框 窗口切换的问题?
- 求教有关JPEG2000的问题!
- 怎么写一个由继承CWin的类,分不够再加,
- 基于VFW的视频捕获再win7下利用Drawdibdraw函数不能显示本地视频
- 使用DrawText的时候,怎么样设置字体大小呀?
- 怎么在内存里画点锕
- 请问 如何能得到 document.write产生新元素 的通知?
在CNumEdit中处理按键按下的情况,滤掉其他的字符,只保留你要的字符。
void XXX::OnChangeEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
UpdateData(true);
int length=m_str.GetLength()-1; //m_str控件的CString型变量,m_ctr控制型变量
if(length>=0){
int tem=m_str.GetAt(length);
if(tem>57||tem<48){//除了0~9
m_str=m_str.Left(length);
UpdateData(false);
m_ctr.SetSel(m_ctr.GetWindowTextLength(),m_ctr.GetWindowTextLength());
}
}
}