Is there a way to invoke the “Identify Monitors” function from C#?

陌路散爱 提交于 2019-12-13 06:31:50

问题


I'm working on a little WPF app that will run fullscreen and I'd like to give the user the ability to choose which monitor it will display on. To make it easier to identify each monitor in the list, I would like to do something like the Windows Display Settings dialog's "Identify Monitors" button.

Is there a way to invoke that function using P/Invoke or something? If not, I can always just open a new WPF window on each monitor containing a number, but I don't want to reinvent the wheel if it's built-in somehow.


回答1:


There's this question - In a C# winform how do identify what monitor the app is displayed on - but it asks to identify which screen the application is running on, so as stated it won't do what you want. However, the System.Windows.Forms.Screen class might provide the methods you need.

It has an array:

Sreeen[] AllScreens;

Loop over the array and draw the index of the array at the centre of rectangle defined by Bounds or WorkingArea.



来源:https://stackoverflow.com/questions/1418623/is-there-a-way-to-invoke-the-identify-monitors-function-from-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!