如何使用一个文件或一些语句更改所有windowsForm的布局 [英] how to change layout of all windowsForm using one file or some statements
问题描述
有没有办法使用一个文件或使用一些编码语句设置所有控件属性。我的意思是将所有标签设置为一个字体或文本框设置为一个大小等等。我必须设置多种形式的布局我想节省我的时间和精力,就像我们在Web应用程序中使用CSS保存一样。 我可以通过转到每个表单来完成,但我不想这样做。是否有任何快捷方式可以像CSS一样控制winform布局,设计设置。执行此任务的方法是什么,我想将单一格式应用于我的WinForms,为什么我需要设置每个表单的布局
is there any possible way to set all control properties using one file or using some coding statements. I mean to to set all label to one font or textboxes to one size etc etc. i have to set layout of many form i want to save my time and efforts just like we save using CSS in web application. i can do it by going to each form but i don't want to do this. is there any shortcut avlaiable like CSS to control winform layout , design settings. What is the way to do this task, i want to apply uni formating to my WinForms that why i required to set layout of each and every form
推荐答案
我看到它的方式,你有两个选择:
- 迭代通过表格中特定类型的所有控件并执行必要的修改。
- 或 -
- 来自
TextBox
的子类,并根据需要使用派生类。 然后,在表单中创建子类的实例。
The way I see it, you have 2 options:
- Iterate through all the controls of a specific type in a form and perform the necessary modifications.
-or-
- Subclass from
TextBox
and use your derived class to behave as required. Then, create instances of your subclass in your form.
这篇关于如何使用一个文件或一些语句更改所有windowsForm的布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!