限制CEdit(Edit Contrl)只能输入数字和小数点
来源:互联网 发布:初中数学助手软件 编辑:程序博客网 时间:2024/05/21 18:31
出处:http://blog.csdn.net/rundll64/article/details/45849573
void CSettingcategory::OnEnChangeEdit2()
{
CString csAreaS;
GetDlgItem( IDC_EDIT2 )->GetWindowText( csAreaS );
// 只允许输数据
int nStringLength = csAreaS.GetLength();
int nDotCount = 0;
// 点字符不能多于1个
for ( int nIndex = 0; nIndex < nStringLength; nIndex++ )
{
if ( csAreaS[ nIndex ] == '.' )
{
nDotCount++;
if ( nDotCount > 1 )
{
CString csTmp;
csTmp = csAreaS.Left( nIndex );
csTmp += csAreaS.Right( csAreaS.GetLength() - nIndex - 1 );
//csRadius = csRadius.Left( nIndex + 1 ) + csRadius.Right( nStringLength - ( nIndex + 1 ) - 1 );
GetDlgItem( IDC_EDIT2 )->SetWindowText( csTmp );
return;
}
}
}
// 不允许输入数字和点以外的字符
for ( int nIndex = 0; nIndex < nStringLength; nIndex++ )
{
if ( csAreaS[ nIndex ] != '.' && ( csAreaS[ nIndex ] > '9' || csAreaS[ nIndex ] < '0' ) )
{
csAreaS = csAreaS.Left( nIndex ) + csAreaS.Right( csAreaS.GetLength() - nIndex - 1 );
GetDlgItem( IDC_EDIT2 )->SetWindowText( csAreaS );
return;
}
}
}
- 限制CEdit(Edit Contrl)只能输入数字和小数点
- 限制CEdit(Edit Contrl)只能输入数字和小数点
- [VC++]限制CEdit(Edit Contrl)只能输入数字和小数点
- [转][VC++]限制CEdit(Edit Contrl)只能输入数字和小数点
- mfc现实edit控件输入限制(只能输入数字和小数点)
- 限制文本框只能输入数字和小数点
- 限制文本框只能输入数字和小数点
- 限制文本框只能输入数字和小数点
- UITextField 限制只能输入数字和小数点,只能有两位小数
- 限制输入框只能输入数字和小数点
- js限制输入框只能输入数字、负数和小数点
- MFC实现Edit输入限制(只允许输入数字,负号和小数点)
- MFC实现Edit输入限制(只允许输入数字,负号和小数点)
- MFC实现Edit输入限制(只允许输入数字,负号和小数点)
- 限制文本框只能输入数字和小数点格式
- C#如何限制文件框只能输入数字和小数点
- JQuery 限制文本框只能输入数字和小数点
- JQuery 限制文本框只能输入数字和小数点
- 如何快速发布NPM模块
- A Summary of Unity Attributes
- bootstrap安装及引用
- HDU 5914 - Triangle
- python学习笔记:类
- 限制CEdit(Edit Contrl)只能输入数字和小数点
- Spark Job 调度 (官方文档翻译)
- NOIP2016 普及组第四题 魔法阵magic 题解
- 解决启动Eclipse返回Exit Code=13
- 带特效的“ViewPager”
- Button 标签实现页面跳转的方法
- TLD算法流程图
- PAT_乙级 1018 锤子剪刀布
- 装饰者设计模式