Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Screen resolution and Form display

Tags:

c#

.net

winforms

I have a C# WinForms application and when I give the executable to different users the application displays in different sizes (based on their screen resolution). Some of the parts of the application can't be seen.

Is there anyway to auto-size the window based on the screen resolution, or is there another approach?

EDIT : furthermore it appears in different styles under different Operating systems, is there away to standardize its design ?

like image 426
illep Avatar asked Dec 04 '25 21:12

illep


1 Answers

It sounds like you have specified your controls with absolute positioning and other layout defaults. In order to make a WinForms application that looks and feels the same and behaves correctly in various resizing scenarios, you need to utilize the Anchor and Dock properties. Arranging controls in WinForms can be a tiring process, but MSDN includes some nice How To's on the subject.

I would also suggest following along with this TechRepublic article, which covers the difference between Anchoring and Docking, and shows you visually what each property accomplishes:

Anchoring example from the TechRepublic Article

like image 126
user7116 Avatar answered Dec 06 '25 10:12

user7116



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!