Question

I have a WinForms Application that was designed to support Full HD resolutions (so 1920x1080). Now this App is also supposed to run on a lower resolution: 1600x900. Is there a way to let the application auto scale itself to fit the lower resolution? Like you would just downscale an image, basically resizing and relocating each control. My current forms and panels have set their size to 1900x1080, so they just extend out of the screen on the lower resolution. I have played around with AutoScaleModes and AutoSize, but the best I could get were Scrollbars so that you at least navigate through the forms. Is such a thing as downscaling an application even possible (retaining dimensions/ relative sizes and positions of the controls)?

Thanks in advance for any inputs on this!

Was it helpful?

Solution

If your main form starts in a maximized mode, it will adjust its size automagically.

But (and this is a huge "but" according to your question): the inner controls won't be scaled as you would see on a smartphone. WinForm is not "vector based" as WPF. If you have a fully loaded form in 1920x1080, when the main form is sized down, the controls won't fit and you will get scrollbars.

So the answer is: No.

OTHER TIPS

The solution is available.

Form.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;

and Make all control autosize = false. make a suitable size of your wish.

The property you are looking for is called Dock, it's a property of the controls.

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.dock(v=vs.110).aspx

This basically tells the control how to fill the available space.

Creating a resolution independent application is not a simple logic. Everything in the window should be resize as per the selected resolution. Not only controls' size you have to change the font size also as per the changes. Here is the example how to create a resolution independent form using C# code. Another way is use DevExpress Tool. This tool provides Layout Countrol Container. You can place each control in separate layout item and assign the minimum and maximum size of control.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top