ExceptionMessageBoxButtons 列舉

定義

指定在例外訊息框中顯示的按鈕。

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

欄位

名稱 Description
OK 0

顯示 確定 按鈕。

OKCancel 1

顯示 確定取消 按鈕。

YesNoCancel 2

顯示 取消 按鈕。

YesNo 3

顯示 按鈕。

AbortRetryIgnore 4

顯示 中止重試忽略 按鈕。

RetryCancel 5

顯示 重試取消 按鈕。

Custom 6

顯示按鈕並附上自訂按鈕文字。

範例

// 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 以確認使用者點擊了哪個按鈕。

適用於