MessageBoxButtons Sabit listesi

Tanım

MessageBoxhangi düğmelerin görüntüleneceğini tanımlayan sabitleri belirtir.

public enum class MessageBoxButtons
public enum MessageBoxButtons
type MessageBoxButtons = 
Public Enum MessageBoxButtons
Devralma
MessageBoxButtons

Alanlar

Name Değer Description
OK 0

İleti kutusunda Tamam düğmesi bulunur.

OKCancel 1

İleti kutusunda Tamam ve İptal düğmeleri bulunur.

AbortRetryIgnore 2

İleti kutusu Durdur, Yeniden Dene ve Yoksay düğmelerini içerir.

YesNoCancel 3

İleti kutusunda Evet, Hayır ve İptal düğmeleri bulunur.

YesNo 4

İleti kutusunda Evet ve Hayır düğmeleri bulunur.

RetryCancel 5

İleti kutusunda Yeniden Dene ve İptal düğmeleri bulunur.

CancelTryContinue 6

İleti kutusunun İptal, Yeniden Dene ve Devam Et düğmelerini içerdiğini belirtir.

Örnekler

Aşağıdaki kod örneğinde, kullanıcıya formun kapanmasını engelleme fırsatı vermek için 'nin nasıl kullanılacağı MessageBox gösterilmektedir. Bu örnek, yönteminin formun FormClosing olayından çağrılsını gerektirir.

private:
   void Form1_FormClosing(Object^ sender, FormClosingEventArgs^ e)
   {
      // If the no button was pressed ...
      if ((MessageBox::Show(
         "Are you sure that you would like to close the form?", 
         "Form Closing", MessageBoxButtons::YesNo, 
         MessageBoxIcon::Question) == DialogResult::No))
      {
         // cancel the closure of the form.
         e->Cancel = true;
      }
   }
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
    const string message =
        "Are you sure that you would like to close the form?";
    const string caption = "Form Closing";
    var result = MessageBox.Show(message, caption,
                                 MessageBoxButtons.YesNo,
                                 MessageBoxIcon.Question);

    // If the no button was pressed ...
    if (result == DialogResult.No)
    {
        // cancel the closure of the form.
        e.Cancel = true;
    }
}
Private Sub Form1_FormClosing( _
    ByVal sender As System.Object, _
    ByVal e As System.Windows.Forms.FormClosingEventArgs) _
    Handles MyBase.FormClosing

    Dim message As String = _
            "Are you sure that you would like to close the form?"
    Dim caption As String = "Form Closing"
    Dim result = MessageBox.Show(message, caption, _
                                 MessageBoxButtons.YesNo, _
                                 MessageBoxIcon.Question)

    ' If the no button was pressed ...
    If (result = DialogResult.No) Then
        ' cancel the closure of the form.
        e.Cancel = True
    End If
End Sub

Açıklamalar

Bu numaralandırma sınıfı tarafından MessageBox kullanılır.

Şunlara uygulanır

Ayrıca bkz.