如何设置系统的屏幕分辨率 [英] How to Set Screen Resolutions of the system

查看:85
本文介绍了如何设置系统的屏幕分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我正在开发一个winform应用程序,该项目的状态显示屏幕分辨率出现问题,所以我尝试在应用程序启动时通过编码根据要求设置屏幕分辨率,该如何做...请帮助

Hello,
I am working on a winform application,from statring of this project i am getting problem with the screen resolutions,so i am trying to set screen resolution as per requirment through the coding when application get started ,how to do this...pls help

推荐答案

此处是在System.Windows.Forms中执行此操作的方法.由于不必使用此代码实际创建任何表单或应用程序,因此也可以在WPF中使用它.

使用System.Windows.Forms.Screen.AllScreens获取具有相同类型System.Windows.Forms.Screen的所有屏幕.如果只需要主屏幕,则只需获取System.Windows.Forms.Screen.PrimaryScreen.查看每个屏幕的属性.特别是,您可以使用System.Windows.Forms.Screen.WorkingAreaSystem.Windows.Forms.Screen.Bounds.

请参阅 http://msdn.microsoft.com/en-us/library/system .windows.forms.screen.aspx [ ^ ].

糟糕!

如何设置屏幕分辨率?!

你不能.来吧,您不能有这样的要求.相反,您必须编写与分辨率无关的软件.如果您对窗口的大小有要求,则可以在最小分辨率的基础上,以与同一应用程序完全相同的方式开发UI在高分辨率屏幕上的外观.这就是为什么您无需设置分辨率而只需获得分辨率的原因. (我希望您理解,无论要求多么强烈,您都不能将分辨率设置得更高,这在物理上是可能的:-).)

—SA
Here is how to do it in System.Windows.Forms. As you don''t have to actually create any form or application with this code, you can also use it in WPF.

Use System.Windows.Forms.Screen.AllScreens to get all your screens of the same type System.Windows.Forms.Screen. If you need only you primary screen, get just System.Windows.Forms.Screen.PrimaryScreen. Look at the properties of each screen. In particular, you can use System.Windows.Forms.Screen.WorkingArea and System.Windows.Forms.Screen.Bounds.

See http://msdn.microsoft.com/en-us/library/system.windows.forms.screen.aspx[^].

Oops!

How to set screen resolution?!!

No, you cannot. Come on, you cannot have such requirement. Just the opposite, you have to write resolution-independent software. If you have requirements for the sizes of the windows, you can develop the UI the way it looks on the higher-resolution screen exactly as the same application on the base minimally required resolution. That''s why you don''t need to set resolution but only get it.
(I hope you understand that you cannot set resolution higher that it is physically possible no matter how strongly it is required :-).)

—SA


这篇关于如何设置系统的屏幕分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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