将所有应用程序文本输入转换为大写 [英] convert all the application text input to Uppercase

查看:100
本文介绍了将所有应用程序文本输入转换为大写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,我们已经开发了一个hr应用程序(winform),它包含将近98个表单,并且已经在我们的组织中进行了测试.
但是现在的问题是,管理层希望所有数据输入都使用大写.我们没有在任何控件中设置任何字符框,现在将字符框更改为所有控件几乎是非常危险的

有人可以建议将输入限制为仅大写吗?我在Program.cs文件中尝试了一些操作,但似乎不起作用

还试图覆盖textbox.textchanged事件,这似乎是一个愚蠢的主意,请考虑将我们视为开发中的新伙伴.

Dear All We had developed a hr application(winform) which consist of almost 98 forms .And its in testing in our organisation .
But the problem now is the management wants all the data inputs to be in UPPERCASE .we had not set any character casing in any of our controls and now its almost very hazardous to change the character casing to all controls

Can anyone suggest any idea to do restrict the input to uppercase only ?.I had tried some thing at the Program.cs file.but it seems not working

Also tried to overide textbox.textchanged event it seems to be a foolish idea any more ideas please considering us as new bie in development

推荐答案

您可以在表格加载时间.

You can call this method at the time of form load.

private void UpparCasingTextBoxes() 
 { 
     Action func = null; 
 
     func = (controls) => 
         { 
             foreach (Control control in controls) 
                 if (control is TextBox) 
                     (control as TextBox).CharacterCasing = CharacterCasing.Uppar 
                 else 
                     func(control.Controls); 
         }; 
 
     func(Controls); 
 }


文本框具有属性 CharacterCasing 设置其值 Upper

祝您编码愉快!
:)
textbox has property CharacterCasing set it''s value Upper

Happy Coding!
:)


这可能是开箱即用的想法.....
Windows窗体的默认字体为"Microsoft Sans Serif,8.25pt"
其子继承相同的字体.
因此您可以将原始的"Microsoft Sans Serif"字体替换为仅大写的字体.例如:-Trajan Pro [字符大小写都保持大写,只是大小不同]
通过"Microsoft Sans Serif"更改新字体的名称
This might be an out of box idea.....
The default font for windows form is "Microsoft Sans Serif, 8.25pt"
its child inherit same font.
so you can replace the original "Microsoft Sans Serif" font by a font which has only uppercase. eg:-Trajan Pro [character remain uppercased in both lower and uppercase,only the size differs]
change the name of the new font by "Microsoft Sans Serif"


这篇关于将所有应用程序文本输入转换为大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆