问题描述
我怎样才能找回我的C#winform应用程序正在运行的屏幕分辨率?
How can I retrieve the screen resolution that my C# Winform App is running on?
推荐答案
您只需要该地区一个标准的应用程序将使用的,即不包括Windows任务栏和停靠窗口?如果是这样,使用。否则,使用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.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应用程序的屏幕分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!