MessageBoxIcon 枚举

指定定义哪些信息要显示的常数。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Enumeration MessageBoxIcon
用法
Dim instance As MessageBoxIcon
public enum MessageBoxIcon
public enum class MessageBoxIcon
public enum MessageBoxIcon
public enum MessageBoxIcon

成员

  成员名称 说明
由 .NET Compact Framework 支持 Asterisk 该消息框包含一个符号,该符号是由一个圆圈及其中的小写字母 i 组成的。 
Error 该消息框包含一个符号,该符号是由一个红色背景的圆圈及其中的白色 X 组成的。 
由 .NET Compact Framework 支持 Exclamation 该消息框包含一个符号,该符号是由一个黄色背景的三角形及其中的一个感叹号组成的。 
由 .NET Compact Framework 支持 Hand 该消息框包含一个符号,该符号是由一个红色背景的圆圈及其中的白色 X 组成的。 
Information 该消息框包含一个符号,该符号是由一个圆圈及其中的小写字母 i 组成的。 
由 .NET Compact Framework 支持 None 消息框未包含符号。 
由 .NET Compact Framework 支持 Question 该消息框包含一个符号,该符号是由一个圆圈和其中的一个问号组成的。 
Stop 该消息框包含一个符号,该符号是由一个红色背景的圆圈及其中的白色 X 组成的。 
Warning 该消息框包含一个符号,该符号是由一个黄色背景的三角形及其中的一个感叹号组成的。 

备注

此枚举由 MessageBox 类使用。对此枚举的每个成员的说明都包含符号的典型表示形式。实际显示的图形是操作系统常数的函数。当前实现中有四个独特的符号,它们被赋予了多个值。

示例

Private Sub button1_Click(sender As Object, e As System.EventArgs)
    If textBox1.Text = "" Then
        MessageBox.Show("You must enter a name.", "Name Entry Error", _
           MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    Else
        ' Code to act on the data entered would go here.
    End If
End Sub
private void button1_Click(object sender, System.EventArgs e) {
   if(textBox1.Text == "") {
      MessageBox.Show("You must enter a name.", "Name Entry Error",
         MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
   }
   else {
      // Code to act on the data entered would go here.
   }
}
private:
   void button1_Click( Object^ sender, System::EventArgs^ e )
   {
      if ( textBox1->Text->Equals( "" ) )
      {
         MessageBox::Show( "You must enter a name.", "Name Entry Error",
            MessageBoxButtons::OK, MessageBoxIcon::Exclamation );
      }
      else
      {
         // Code to act on the data entered would go here.
      }
   }
protected void button1_Click(Object sender, System.EventArgs e)
{
    if (textBox1.get_Text().Equals("")) {
        MessageBox.Show("You must enter a name.", "Name Entry Error",
            MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
    }
    else {
        // Code to act on the data entered would go here.
    } 
} //button1_Click

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

System.Windows.Forms 命名空间