问题
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