如何从一个C#winform应用程序的屏幕分辨率? [英] How to retrieve the Screen Resolution from a C# winform app?

查看:392
本文介绍了如何从一个C#winform应用程序的屏幕分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能找回我的C#winform应用程序正在运行的屏幕分辨率?

How can I retrieve the screen resolution that my C# Winform App is running on?

推荐答案

您只需要该地区一个标准的应用程序将使用的,即不包括Windows任务栏和停靠窗口?如果是这样,使用Screen.WorkingArea物业。否则,使用<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.screen.bounds.aspx\">Screen.Bounds.

Do you need just the area a standard application would use, i.e. excluding the Windows taskbar and docked windows? If so, use the Screen.WorkingArea property. Otherwise, use Screen.Bounds.

如果有多个显示器,你需要从你的形式,即抓取屏幕。

If there are multiple monitors, you need to grab the screen from your form, i.e.

Form myForm;
Screen myScreen = Screen.FromControl(myForm);
Rectangle area = myScreen.WorkingArea;

如果你想知道哪个是主显示屏,使用Screen.Primary属性。此外,您还可以从<一个屏幕列表href=\"https://msdn.microsoft.com/en-us/library/system.windows.forms.screen.allscreens(v=vs.110).aspx\">Screen.AllScreens属性。

If you want to know which is the primary display screen, use the Screen.Primary property. Also, you can get a list of screens from the Screen.AllScreens property.

这篇关于如何从一个C#winform应用程序的屏幕分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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