Event for when the number of displays changes in .NET?
I have a program that needs to update some internal data structures when the number of attached displays changes, like when you put your laptop into the docking station and your dual monit开发者_如何学编程ors comes to life.
Couple of questions in this regard:
- Is there such an event in .NET?
- If not, is there a windows message I can listen for?
- Will Screen.AllScreens be updated?
- Will it be updated before I catch the event? or after? or is that indeterminate?
If it matters, this is .NET 3.5 and C#.
Have you looked into SystemEvents.DisplaySettingsChanged
Event:
Occurs when the user changes the display settings.
There's not much more information than this on the MSDN but it might be of some use.
精彩评论