在具有多个监视器的系统上,如何列出监视器并将表单最大化为其中一个?

时间:2023-02-05 11:41:11

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".

我正在开发一个显示多个图表的.NET应用程序。我的用户希望能够轻松地说“在第四台显示器上获取图表#3并将其最大化”。

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.)

如何确定监视器的数量,以便我可以选择“监视器#1,监视器#2等”? (并非每个用户都有相同数量的显示器。)

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

一旦用户选择了特定的监视器,我如何使用该信息来定位他们试图最大化的图表?

3 个解决方案

#1


3  

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

Screen类通过查找可用屏幕帮助您。

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.

您可以自己定位,或让Windows处理它,只需将表单放在右侧的“屏幕”上,并最大化它。或者使用屏幕的WorkingArea,并自己填写。

#2


0  

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.

尝试使用System.Windows.Forms中的Screen类。 AllScreens静态成员包含连接到系统的所有屏幕的列表。选择屏幕后,您可以使用Bounds成员来决定如何最大化该窗口的窗口。

#3


0  

Use SystemInformation.MonitorCount and other methods from this class.

使用SystemInformation.MonitorCount和此类中的其他方法。

#1


3  

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

Screen类通过查找可用屏幕帮助您。

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.

您可以自己定位,或让Windows处理它,只需将表单放在右侧的“屏幕”上,并最大化它。或者使用屏幕的WorkingArea,并自己填写。

#2


0  

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.

尝试使用System.Windows.Forms中的Screen类。 AllScreens静态成员包含连接到系统的所有屏幕的列表。选择屏幕后,您可以使用Bounds成员来决定如何最大化该窗口的窗口。

#3


0  

Use SystemInformation.MonitorCount and other methods from this class.

使用SystemInformation.MonitorCount和此类中的其他方法。