messagebox.show()方法的问题 [英] issue on messagebox.show() method

查看:106
本文介绍了messagebox.show()方法的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道win表单中的模态和无模式对话框。



form.show(); - >无模式dailog。

form.showdialog(); - >模态对话框







但是每当我们在消息框上的cal show方法它充当模态对话框你能解释一下这里发生了什么。

i know the what is modal and modeless dialogs in win forms.

form.show();-->modeless dailog.
form.showdialog();-->modal dialog



but whenever we cal show method on messagebox it acts as modal dialog can you please explain me what is happening here.

推荐答案

一个 MessageBox Form 的特殊子类,总是 modal;因为这是确认/信息/通知消息框应该是什么。



如果您希望消息框显示为无模式,那么您需要表单,而不是 MessageBox 。您可以继承 Form 类来创建自己的消息框版本,模仿经典消息框的外观和行为,但能够调用显示 ShowDialog 方法。
A MessageBox is a special subclass of Form which is always modal; because this is what a confirmation/information/notification message box is supposed to be.

If you want your message box to appear as modeless, then you needa Form, not a MessageBox. You can subclass the Form class to create your own version of message box, mimicing the look and behaviour of the classic message box, but with the ability to call either Show or ShowDialog method.


这篇关于messagebox.show()方法的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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