简体   繁体   English

消息框上的打开按钮

[英]Open button on Messagebox

I have a WinForms application, and when it is finished running, displays a message box with just an OK button.我有一个 WinForms 应用程序,当它完成运行时,会显示一个带有 OK 按钮的消息框。

Is it possible to have an OPEN button on the message box too?消息框上也可以有一个打开按钮吗?

I found this code online:我在网上找到了这段代码:

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons);

But it only gives basic commands, like Yes / No , OK / Cancel , etc. It doesn't show any open button.但它只提供基本命令,如Yes / NoOK / Cancel等。它不显示任何打开按钮。

I want to OPEN a text file after my program has finished running.我想在我的程序完成运行后打开一个文本文件。

Any help would be greatly appreciated.任何帮助将不胜感激。

No, you can't have any other values in a message box rather than the default, the MessageBoxButtons is predefined enum and you can't add to it.不,您不能在消息框中有任何其他值,而不是默认值, MessageBoxButtons是预定义的enum ,您不能添加到它。 The solution is either use some custom message box, check this , or implement your own MessageBoxForm and add your custom settings to it, check this .解决方案是使用一些自定义消息框,选中这个,或者实现你自己的 MessageBoxForm 并将你的自定义设置添加到它,选中这个

The MessageBox.Show methods exposes serval overloads. MessageBox.Show 方法公开了serval 重载。 You can use one of them as you like.您可以随意使用其中之一。 To invoke a MessageBox, simply execute following line:要调用 MessageBox,只需执行以下行:

MessageBox.Show("Hi"); MessageBox.Show("你好");

For information you can find on MSDN.有关信息,您可以在 MSDN 上找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM