查找所有显示器的编号和分辨率
如何轮询窗口来查看连接的显示器以及它们运行的分辨率?
How would one poll windows to see what monitors are attached and what resolution they are running at?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 C# 中:
屏幕
Class 表示单个系统上的一个显示设备或多个显示设备。您需要Bounds
属性。In C#:
Screen
Class Represents a display device or multiple display devices on a single system. You want theBounds
attribute.使用Screen 类。
您可以查看
Screen.AllScreens
数组中的所有显示器,并使用Bounds
属性检查每个显示器的分辨率和位置。请注意,某些视频卡会将两个显示器合并为一个非常宽的屏幕,因此 Windows 认为只有一个显示器。如果你愿意,你可以检查屏幕的宽度是否超过其高度的两倍;如果是这样,它可能是一个水平跨度,您可以将其视为两个相等的屏幕。但是,这比较复杂,您不需要这样做。垂直跨度也受支持,但不太常见。
Use the Screen class.
You can see all of the monitors in the
Screen.AllScreens
array, and check the resolution and position of each one using theBounds
property.Note that some video cards will merge two monitors into a single very wide screen, so that Windows thinks that there is only one monitor. If you want to, you could check whether the width of a screen is more than twice its height; if so, it's probably a horizontal span and you can treat it as two equal screens. However, this is more complicated and you don't need to do it. Vertical spans are also supported but less common.
http://msdn.microsoft.com/en-us/magazine/cc301462。 aspx
GetSystemMetrics 是一个方便的函数,您可以使用它来获取各种全局尺寸,例如图标的大小或窗口标题的高度。在 Windows 2000 中,有一些新参数(如 SM_CXVIRTUALSCREEN 和 SM_CYVIRTUALSCREEN)可获取多显示器系统的屏幕虚拟尺寸。 Windows 新手和专业人士都应该查看 GetSystemMetrics 的文档,以了解可以获得的所有不同系统指标(维度)。请参阅 http://msdn.microsoft 上的 Platform SDK 了解最新信息。 com/library/en-us/sysinfo/sysinfo_8fjn.asp。 GetSystemMetrics 是您经常需要使用的一个方便的功能,并且每个版本的 Windows 都会出现新功能。
http://msdn.microsoft.com/en-us/magazine/cc301462.aspx
GetSystemMetrics is a handy function you can use to get all sorts of global dimensions, like the size of an icon or height of a window caption. In Windows 2000, there are new parameters like SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN to get the virtual size of the screen for multiple monitor systems. Windows newbies—and pros, too—should check out the documentation for GetSystemMetrics to see all the different system metrics (dimensions) you can get. See the Platform SDK for the latest at http://msdn.microsoft.com/library/en-us/sysinfo/sysinfo_8fjn.asp. GetSystemMetrics is a handy function you frequently need to use, and new stuff appears with every version of Windows.