How do I automatically resize the Form when the screen resolution changes between design-time and runtime?

Platform: WinForms| Category: Form

The framework automatically resizes the form if the current Font size during runtime is different from the font size in design-time. It however doesn’t auto size when the resolution changes. But it should be easy for you to accomplish. You could derive a custom Form, provide a ‘ScreenResolutionBase’ property that could return the current screen resolution (Screen.PrimarScreen.Bounds will give you this). This value will get serialized in code during design time. Then during runtime in the Form’s OnLoad you could check for the current screen resolution and resize the Form appropriately.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.