on a system with multiple monitors, how to list monitors and maximize a form into one of them?

StackOverflow https://stackoverflow.com/questions/201403

  •  03-07-2019
  •  | 
  •  

Question

I am working on a .NET application that displays multiple charts. My users would like an easy way to say "take chart #3 and maximize it on my fourth monitor".

How can I determine the number of monitors so I can give them a selection of "monitor #1, monitor #2, etc"? (Not every user has the same number of monitors.)

And once the user has selected a particular monitor, how can I use that information to position the chart they're trying to maximize?

Was it helpful?

Solution

The Screen class helps you a lot by finding the available screens.

When you "maximize" a form, the form will automatically maximize to the size of the Screen the form is in.

You can position it yourself, or let Windows take care of it, by just placing the form on the right "Screen", and maximizing it. Or use the WorkingArea of the screen, and fill that yourself.

OTHER TIPS

Try the Screen class in System.Windows.Forms. The AllScreens static member contains the list of all screens attached to the system. Once you choose a screen, you can use the Bounds member to decide how to maximize a window to that screen.

Use SystemInformation.MonitorCount and other methods from this class.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top