Find Number and resolution to all monitors

后端 未结 3 1135
长情又很酷
长情又很酷 2020-12-08 07:47

How would one poll windows to see what monitors are attached and what resolution they are running at?

3条回答
  •  忘掉有多难
    2020-12-08 08:16

    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 the Bounds 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.

提交回复
热议问题