Windows Forms Resolution Problem

I designed a screen with a resolution of 1024 * 780 in Windows Forms, but some say that it does not fit properly at higher resolutions. Is there any way to handle this?

Is there a way to make Windows Forms applications the same in all resolutions?

+4
source share
3 answers

My recommendation is not so much to “make it the same” on all screens, but to design the GUI so that it scales more elegantly up and down. Layout, docking and binding managers are your friends at Winforms. TableLayoutPanel is very useful for this kind of thing. Splitters also help ...

Finally, this is one of those issues that WPF is about to solve. WPF makes extensive use of layout managers. It is much more like Java or GTK than Winforms or even VB (old-school VB).

+5
source

This is what makes you say, "There must be a better way."

My solution for this was to declare a global ScalingFactor variable bound to the current screen resolution. Then the dimensions of each visual element were multiplied by this coefficient.

So, if I developed a form for resolution A, and resolution B will be 1.2 times larger, the width of window A will be * 1.2, the fonts will be fontSize * 1.2, the size of the text box will be * 1.2.

Not fun.

There may be third-party tools that you can buy and will perform this scaling.

Another thing to check before starting any of these roads is actually the screen resolution or dpi settings that make it look bad. Usually a higher resolution will only reduce the size of the image, but atypical dpi, for example, when the user selects "large fonts", will be detrimental.

0
source

You can use the element's property of binding, and the form autoScaleMode property is set to "None".

0
source

All Articles