Hi!
We are developing an application using Windows Forms and recently changed the font of our application from a fixed font to the current system font. Now there is a problem with the AutoScaleMode for which I couldn't find a solution after two days of reading heaps of topics...
The situation is as follows:
- We a form base class with some default buttons (e.g. btnDefault ) and many dialogs which are derived from this form
- In these dialogs, we want to use AutoScaleMode = Font
- The dialogs are developed on different computers with different screen sizes and font setting
Now if we add
AutoScaleMode = Font and some
AutoScaleDimensions to the base class, the designer automatically modifies the size and location for each control (according to the
AutoScaleDimensions of the current computer) when the dialog is opened in the designer. If we open a dialog derived from this base form, the designer also adds code (Size and Location) for
btnDefault . This is quite annoying, as we have a style guide with exact size values for each button. And if we wanted to change the size of
btnDefault , we would have to re-open all dialogs (~300) in the designer.
Now I tried the following workaround: I set
AutoScaleMode = None and some fixed
AutoScaleDimensions in the dialog base class to prevent it from changing size at design-time. Now in the Load event handler, I set
AutoScaleMode = Font to have the dialog scaled at run-time. Is this the correct approach? Or has anyone an idea how to solve this problem?
Thanks in advance for reading this far!