当前位置: 移动技术网 > IT编程>开发语言>.net > Winform中通过代码设置DevExpress的TextEdit的类型为Numbernic

Winform中通过代码设置DevExpress的TextEdit的类型为Numbernic

2019年09月10日  | 移动技术网IT编程  | 我要评论

转胎丸,姜中华,黄凯圣

场景

使用devexpress的edittext控件时,需要限制其输入类型为数字。

正常来说是窗体上拖拽一个textedit,然后在设计窗口点击小三角,选择change mask

 

 

但是如果说textedit控件不是拖拽上去而是由代码生成的,那么在代码中怎样设置只能输入数字。

关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。

实现

mintexteditx.properties.mask.masktype = devexpress.xtraeditors.mask.masktype.numeric;

 

完整示例代码

#region 生成一个下限输入框
            //添加下限输入框
            textedit mintexteditx = new textedit();
            mintexteditx.text = xattribute.min.tostring();
            mintexteditx.properties.mask.masktype = devexpress.xtraeditors.mask.masktype.numeric;
            mintexteditx.width = global.chart_option_width;
            mintexteditx.location = new point(global.nogroup_horizontal_distance + ylist.count * horizontaldistance, global.group_vertical_distance * 2 + radiogroupx.height);
            this.controls.add(mintexteditx);
            #endregion

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网