سؤال

I have a windows forms application in C#. Now I want to change the font size of all the screens. That is difficult because my project has so many screens. Is there any way to change the font size of all the screens in C# windows forms application at once?

هل كانت مفيدة؟

المحلول

Expand properties in solution explorer of the project. Open Settings and set default font size and other defaults for application.

Settings Designer

In the constructor of each form add following line:

//set fonts           
this.Font = Settings.Default.appFont;

You can change/set the value of Settings.Default.appFont.

If you want to access object of all screens/forms then you must create CollectionBase for each form. Collection can be used to assign fonts to all screens from one class. check this link http://support.microsoft.com/kb/815707

Also Application.OpenForms collection could also be helpful.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top