DataGridView单元格输入全角转半角
2012-03-27 12:14
656 查看
//编辑单元格控件发生事件 private void GridDetail_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { //获取列序号 int columnIndex = GridDetail.CurrentCell.ColumnIndex; //单元格转化成文本框 TextBox tb = e.Control as TextBox; //委托单元格KeyPress事件 tb.KeyPress +=new KeyPressEventHandler(tb_KeyPress); } //单元格KeyPress事件 private void tb_KeyPress(object sender, KeyPressEventArgs e) { //全角转半角 if (e.KeyChar >= 65296 && e.KeyChar <= 65305) { e.KeyChar -= Convert.ToChar(65248); } }
相关文章推荐
- 文本框限制输入(半角,全角互转),以及控制输入法问题,解决方法整合
- css ime-mode控制输入全角和半角
- [轉]【经典问题】关于JS验证文本框输入只能输入半角,不让输入全角
- 用javascript限制input输入长度(考虑全角半角)
- input输入框将全角输入的数字转换为半角
- 中文全角和半角输入有什么区别?
- WinForm中的TextBox控件输入全角数字自动转为半角数字
- 不能输入全角字符 全角转换为半角 去掉全角下的所有空格
- 注意用户体验细节--把窗体控件输入由全角转换为半角
- 不能输入全角字符 全角转换为半角 去掉全角下的所有空格
- 如何判断在javascript中输入的文字是全角还是半角?
- 输入的全角字符转换成半角字符--css、js、ASP.NET
- 半角输入与全角输入的转化
- 类库------对一些字符串进行操作的类1.判断输入是否数字2.截取字符串函数3.过滤输入信息4.生成随机数5.生成验证码图片6.获取汉字第一个拼音7.半角转全角8.全角转半角
- 用javascript限制input输入长度(考虑全角半角)
- 半角输入与全角的相互转化
- C#输入全角转半角以及格式检查
- 中文全角和半角输入有什么区别?
- 注意用户体验细节--把窗体控件输入由全角转换为半角
- 中文全角和半角输入有什么区别