C# Winforms 消息框属性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1326566/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C# Winforms Message Box Properties
提问by Moon
in C# winforms when we display a message box it has no title in the title bar and no title in its button that is in the task bar.
在 C# winforms 中,当我们显示消息框时,它在标题栏中没有标题,在任务栏中的按钮中也没有标题。
What if i want to set title and icon for a message box.
如果我想为消息框设置标题和图标怎么办。
one option is that create a form that appears and behaves like a message box and i show and hide it when i want. yes that can be done but i want to modify the "MessageBox"
一种选择是创建一个显示和行为类似于消息框的表单,我可以在需要时显示和隐藏它。是的,可以完成,但我想修改“MessageBox”
采纳答案by itowlson
Use a MessageBox.Show overload such as:
使用 MessageBox.Show 重载,例如:
public static DialogResult Show(
string text,
string caption,
MessageBoxButtons buttons,
MessageBoxIcon icon
)
passing your title bar text in captionand your icon in icone.g.
在通过标题栏的文字说明,你的图标图标如
MessageBox.Show("Oh noes!", "My Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
回答by colithium
There is an overloaded version of show message box that will accept a title string and let you specify the icon and number/type of buttons.
有一个显示消息框的重载版本,它将接受标题字符串并让您指定按钮的图标和数量/类型。
回答by Andy White
The MessageBox.Show method has a bunch of overrides that allow you to set the properties of the pop-up.
MessageBox.Show 方法有一堆覆盖,允许您设置弹出窗口的属性。
http://msdn.microsoft.com/en-us/library/system.windows.forms.messagebox.show%28VS.71%29.aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.messagebox.show%28VS.71%29.aspx