如何调整窗体上的控件,以适应不同的决议? [英] How do I resize controls on a form to fit different resolutions?

查看:188
本文介绍了如何调整窗体上的控件,以适应不同的决议?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个小型应用程序,有一些按钮和标签。在我的开发PC它适合在窗口上,但在其他机器的形式控制变得越来越小。我的屏幕分辨率为1680×1050和客户端屏解决方案为1024x768。是否有可能使控制自动适应屏幕的解决方案?

I'm developing a small application that has a few button and labels. On my development PC it fits on the window, but on other machines the controls of forms get smaller. My screen resolution is 1680x1050 and client screen solution is 1024x768. Is it possible to make controls auto fit the screen solution?

推荐答案

在.NET世界中,你可以使用查询的决议(和其他东西):

In the .NET world, you can query the resolution (and other things) using:

<一个href="http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.primarymonitorsize.aspx"相对=nofollow> SystemInformation.PrimaryMonitorSize

和返回你一双整数,我相信,在大小返回值会告诉你的尺寸以像素为单位。

and that returns you a pair of integers, I believe, in the Size return value that will tell you the dimensions in pixels.

如果您已经开发了巧妙的形式 - 利用布局和期待该计划可能会在不同的分辨率下运行,你可以把这些信息并保持显示器寻找正确的。

If you've developed your forms smartly - utilizing layouts and expecting the program might run on different resolutions, you can take that info and keep the display looking correct.

希望有所帮助。

这篇关于如何调整窗体上的控件,以适应不同的决议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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