拥有的WinForms消息框出现在所有屏幕上,也可以指定主要或次要等。 [英] Have winforms MessageBox appear on all screens, or specify Main or Secondary etc.

查看:149
本文介绍了拥有的WinForms消息框出现在所有屏幕上,也可以指定主要或次要等。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WinForms应用程序其功能是作为一个报警系统,但很多谁将会使用我的计划将有多个屏幕的人。该警报是时间敏感,所以最好我希望他们出现在所有屏幕上,或者能够指定一个屏幕,让用户更容易注意到它。默认情况下,消息框出现在主屏幕上,我找不到什么真正的任何信息做WinForms和不同显示器。

I have a winforms app which functions as an alert system, however a lot of the people who will use my program will have multiple screens. The alerts are time sensitive, so ideally I'd like them to appear on all screen, or to be able to specify a screen, so the user is more likely to notice it. By default the message boxes appear on the main screen, and I can't find any info on anything really to do with winforms and different monitors.

偶不必是一个消息中,如果存在可以进行做同样的功能,但也多屏幕那会是另一个的winform功能大。

The doesn't even have to be a message box, if there is another winform function which can be made to do the same functionality but also multiple screens that'd be great.

在一个侧面说明,才有可能从只有1关闭多个消息框被接受?

On a side note is it possible to close multiple messageboxes from only 1 being accepted?

推荐答案

我觉得最简单的办法是创建一个自定义窗体,而不是使用现有的消息框。这样,你可以使用显示方法,而不是的ShowDialog 。这将允许您展示多个表单,并关闭所有的人都从一个单一的响应。

I think the easiest thing to do is create a custom form rather than using the existing message box. That way you can use the Show method rather than ShowDialog. This would allow you show multiple forms and close all of them from a single response.

至于将它们放置在多个屏幕上:你可以找到与现有的屏幕 System.Windows.Forms.Screen.AllScreens 。这些每个人都有一个边界属性,它会告诉你每个屏幕的坐标和大小是什么。您创建的每个自定义表单之后,你可以指定它的位置属性,将其放置您所选择的屏幕上。

As to placing them on multiple screens: You can find the existing screens with System.Windows.Forms.Screen.AllScreens. Each one of those has a Bounds property which will show you what the coordinates and size of each screen is. After you create each custom form you can specify it's Location property to place it on the screen of your choice.

这篇关于拥有的WinForms消息框出现在所有屏幕上,也可以指定主要或次要等。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆