Open button on Messagebox

本秂侑毒 提交于 2019-12-25 03:55:39

问题


I have a WinForms application, and when it is finished running, displays a message box with just an OK button.

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.

I want to OPEN a text file after my program has finished running.

Any help would be greatly appreciated.


回答1:


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




回答2:


The MessageBox.Show methods exposes serval overloads. You can use one of them as you like. To invoke a MessageBox, simply execute following line:

MessageBox.Show("Hi");

For information you can find on MSDN.



来源:https://stackoverflow.com/questions/6648599/open-button-on-messagebox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!