Windows Develop Bookmark and Share   
 index > Windows Forms Designer > AutoScaleMode and development on different machines
 

AutoScaleMode and development on different machines

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!
  • Edited byNexcis Monday, August 24, 2009 12:39 PMFormatting
  • Edited byNexcis Monday, August 24, 2009 12:40 PM
  •  
Nexcis  Monday, August 24, 2009 12:39 PM

Hi,

Base on my understanding, you want to change the inherited control in the child form. You can set modifiers properties of the base form controls to �strong>protected� This will allow the child form to resize the inherited controls.

More information:

Everything you wanted to know about Forms Inheritance in VB.NET - “Best�/span>

http://www.codeproject.com/KB/dotnet/BestFormInheritance.aspx

http://groups.google.com/group/microsoft.public.dotnet.framework.windowsforms/browse_thread/thread/158d04627225183a/b76d7d9e9093e4fa?hl=en#b76d7d9e9093e4fa

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Monday, August 31, 2009 9:29 AM

Hi,

Base on my understanding, you want to change the inherited control in the child form. You can set modifiers properties of the base form controls to �strong>protected� This will allow the child form to resize the inherited controls.

More information:

Everything you wanted to know about Forms Inheritance in VB.NET - “Best�/span>

http://www.codeproject.com/KB/dotnet/BestFormInheritance.aspx

http://groups.google.com/group/microsoft.public.dotnet.framework.windowsforms/browse_thread/thread/158d04627225183a/b76d7d9e9093e4fa?hl=en#b76d7d9e9093e4fa

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Monday, August 31, 2009 9:29 AM

You can use google to search for other answers

Custom Search

More Threads

• displaying multiple forms in mdi
• Visual inheritance, Design Error
• VSNET 2005 FINAL release can't open a form
• IDE Shrunk form on restart, making controls inaccessible
• Who lower a automatic scrollbar in a ListView
• User Control child controls move around
• .Images.SetKeyName designer generated code exception
• TabControl and Images not showing
• Custom type collection design time serialization problem
• How to load a form by myself ?