views:

55

answers:

1

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 monitors 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#.

+4  A: 

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.

ChrisF
Probably close enough, and then simply enumerate Screen.AllScreens.
Wim Hollebrandse
This was exactly what I was looking for.
Lasse V. Karlsen