在C#中设计全屏应用程序的最佳方法是什么? [英] What's the best way to design a full screen application in C#?

查看:115
本文介绍了在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.

这是我的全屏代码:

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

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


推荐答案

船锚和码头。

锚点将绑定控件。 Dock属性设置其扩展/收缩的方式。

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.

这篇关于在C#中设计全屏应用程序的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆