简体   繁体   中英

What's the best way to design a full screen application in C#?

I want to know the best way to design a full screen form, like positioning controls in a way that they won't get messed up if the user's resolution is different.

This is my fullscreen code:

int w = Screen.PrimaryScreen.Bounds.Width;
int h = Screen.PrimaryScreen.Bounds.Height;

this.Location = new Point(0, 0);
this.Size = new Size(w, h);

Anchors and Docks.

The Anchor will bind the control. The Dock property sets how it expands/shrinks.

So if you assign a button anchor to "Top, left" it's size and position stay locked on those sides. So if you dragged the Form window wider, the object would expand to towards the right and towards the bottom.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM