I have a PC with 3 monitors. Each monitor will display different information.
When I launch my WinForms
application, I will query all the displays using Screen.AllScreens
, so that I can decide what to shown on which screen.
I always assume the array returned are actually indexed according to the screen number. Means screen 1, following by screen 2 and following by screen 3
It had been running without any problem for the past 10 years, until recently the computer was changed. I found that the index is not always correct. Some times it will return screen 2, screen 1, screen 3.
But at the Display are still showing the correct screen number when we Identify them using Windows 10.
Checking the DeviceName
returned by Screen.AllScreens
it shows something like \\.\DISPLAY2, \\.\DISPLAY1, \\.\DISPLAY3.
So I guess I need to correlate the DeviceName
with the Screen Number. May I know what is the best way? Can I assume the DeviceName
always appears as \\.\DISPLAY##, so that I can parse the last digits to decide the Screen Number?