ExceptionMessageBoxButtons 枚举

定义

指定要在异常消息框中显示的按钮。

public enum class ExceptionMessageBoxButtons
public enum ExceptionMessageBoxButtons
type ExceptionMessageBoxButtons = 
Public Enum ExceptionMessageBoxButtons
继承
ExceptionMessageBoxButtons

字段

AbortRetryIgnore 4

显示 中止重试忽略 按钮。

Custom 6

显示带有自定义按钮文本的按钮。

OK 0

显示 “确定 ”按钮。

OKCancel 1

显示 “确定 ”和“ 取消 ”按钮。

RetryCancel 5

显示 “重试 ”和“ 取消 ”按钮。

YesNo 3

显示 “是 ”和 “否 ”按钮。

YesNoCancel 2

显示 “是”、“ ”和“ 取消 ”按钮。

示例

// Define the message and caption to display.
string str = @"Are you sure you want to delete file 'c:\somefile.txt'?";
string caption = "Confirm File Deletion";

// Show the exception message box with Yes and No buttons.
ExceptionMessageBox box = new ExceptionMessageBox(str,
    caption, ExceptionMessageBoxButtons.YesNo,
    ExceptionMessageBoxSymbol.Question,
    ExceptionMessageBoxDefaultButton.Button2);

if (DialogResult.Yes == box.Show(this))
{
    // Delete the file.
}
' Define the message and caption to display.
Dim str As String = "Are you sure you want to delete file 'c:\somefile.txt'?"
Dim caption As String = "Confirm File Deletion"

' Show the exception message box with Yes and No buttons.
Dim box As ExceptionMessageBox = New ExceptionMessageBox(str, _
 caption, ExceptionMessageBoxButtons.YesNo, _
 ExceptionMessageBoxSymbol.Question, _
 ExceptionMessageBoxDefaultButton.Button2)

If Windows.Forms.DialogResult.Yes = box.Show(Me) Then
    ' Delete the file.
End If

注解

使用 Custom时,必须先调用 SetButtonText 来设置按钮文本,然后才能显示消息框。 用户关闭异常消息框后,调用 CustomDialogResult 以确定用户单击的按钮。

适用于