以编程方式使表单在不同的屏幕分辨率下工作... [英] Making Forms Work on Different Screen Resolutions Programatically...

查看:136
本文介绍了以编程方式使表单在不同的屏幕分辨率下工作...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上述C#表单的最佳做法是什么?谢谢.

What''s the best practice for C# Forms for the above? Thanks.

推荐答案

我遇到了这个问题,我不知道我是否采用了最佳方法,但是我经常使用flowlayoutpanels并使用百分比,并且总是最大化我的表单.

可能不是最好的方法,但是它可行,您可以使用System.Windows.Forms.SystemInformation.PrimaryMonitorSize属性获得最大大小
I had this problem and I don''t know if I took the best approach but I used flowlayoutpanels a lot using percentages and always maximized my form.

probably not the best approach but it worked, you can get max size using System.Windows.Forms.SystemInformation.PrimaryMonitorSize property


您可以使用AutoScaleMode属性

You can use AutoScaleMode property


在.NET之前,我手工"解决了此问题.我将控件布置为可以接受的最低分辨率.然后,为获得更高的分辨率,我在X和Y方向上留有额外的空间.

我允许选定的控件按此额外空间的一定百分比增长".例如,我的按钮控件忽略了多余的空间,但是一个列表框会使用它向用户显示更多信息.

我还定义了控件的行和列,即使控件之间也保持相同的空间当这些控件中的一个或多个控件增长时.

通过停靠和锚定,您通常可以在.NET中提出一个更简单的解决方案.
Before .NET I solved this problem "by hand". I arranged the controls to look ok at the lowest acceptable resolution. Then for higher resolutions I had extra space in the X and Y directions.

I allowed selected controls to "grow" by a percentage of this extra space. For example, my button controls ignored extra space, but a list box would use it to show more of its information to the user.

I also defined rows and columns of controls that would keep the same space between them even when one or more of those controls grew.

With docking and anchoring you can often come up with a simpler solution in .NET.


这篇关于以编程方式使表单在不同的屏幕分辨率下工作...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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