hdkhardik
hdkhardik

Reputation: 662

How to make .net winform application resolution friendly

I am trying to make my winforms application made with C#.Net, resolution friendly. I tried to do so in programming way by just adjusting a size of all control according to ratio of screen resolution. But it doesn't give perfect resolution in every forms.

Upvotes: 2

Views: 479

Answers (2)

György Kőszeg
György Kőszeg

Reputation: 18013

I tried to do so in programming way by just adjusting a size of all control according to ratio of screen resolution.

I think you mix two things.

  1. To adjust your form to the Windows DPI settings (making your controls smaller or larger), you don't need to do anything, this is performed automatically. Just change the DPI settings and check the effect.

  2. To adapt your forms to the actual resolution just make it sure that your forms are either resizable (and the controls are docked) or the non-resizable dialogs will show at least some scrollbars if the resolution is too small. Anchors can be a pain especially if you have derived forms or user controls but you can always use docking.

Upvotes: 4

Strah Behry
Strah Behry

Reputation: 581

You could also use certain resolution breakpoints where the size of the anchors change. For example at 1024x768 1600x900 1920x1080 the controls all change to a set size, inbetween they just take the closest resolution breakpoint to them (1200x900 would take 1024x768).

Often I've had problems trying to make them completely dynamic and I've been handling it like this. Upon resize just call a function that checks the current size and if needed resizes all the anchors.

Upvotes: 2

Related Questions