MessageBoxOptions Sabit listesi

Tanım

bir MessageBoxüzerindeki seçenekleri belirtir.

Bu sabit listesi, üyeleri için bit düzeyinde karşılaştırmayı destekler.

public enum class MessageBoxOptions
[System.Flags]
public enum MessageBoxOptions
[<System.Flags>]
type MessageBoxOptions = 
Public Enum MessageBoxOptions
Devralma
MessageBoxOptions
Öznitelikler

Alanlar

DefaultDesktopOnly 131072

İleti kutusu etkin masaüstünde görüntülenir. Bu sabit, ile benzerdir ServiceNotification, ancak sistem ileti kutusunu yalnızca etkileşimli pencere istasyonunun varsayılan masaüstünde görüntüler. İleti kutusunu görüntüleyen uygulama odağı kaybeder ve ileti kutusu görsel stiller kullanılmadan görüntülenir. Daha fazla bilgi için bkz . Görsel Stiller ile İşleme Denetimleri.

RightAlign 524288

İleti kutusu metni sağa hizalanmış.

RtlReading 1048576

İleti kutusu metninin sağdan sola okuma sırasıyla görüntüleneceğini belirtir.

ServiceNotification 2097152

İleti kutusu etkin masaüstünde görüntülenir. Çağıran, kullanıcıya olayı bildiren bir hizmettir. Show , bilgisayarda oturum açmış bir kullanıcı olmasa bile geçerli etkin masaüstünde bir ileti kutusu görüntüler.

Örnekler

Aşağıdaki örnekte, bir parametresini içeren aşırı yüklemeleri MessageBox.Show tarafından desteklenen seçeneklerle birlikte bir options öğesinin nasıl görüntüleneceği MessageBox gösterilmektedir. dize değişkeninin ServerNameboş olduğunu doğruladıktan sonra örnekte, kullanıcıya işlemi iptal etme seçeneği sunan bir soru kutusu simgesiyle birlikte görüntülenir MessageBox . Örnek, metni iletişim kutusunun sağ kenarına hizalamak için numaralandırma üyesini kullanır MessageBoxOptions.RightAlign . Yöntemin Show dönüş değeri olarak değerlendirilirse DialogResult.Yes, öğesini görüntüleyen MessageBox form kapatılır.

private:
   void validateUserEntry2()
   {
      // Checks the value of the text.
      if ( serverName->Text->Length == 0 )
      {
         // Initializes the variables to pass to the MessageBox::Show method.
         String^ message = "You did not enter a server name. Cancel this operation?";
         String^ caption = "No Server Name Specified";
         MessageBoxButtons buttons = MessageBoxButtons::YesNo;
         System::Windows::Forms::DialogResult result;
         
         // Displays the MessageBox.
         result = MessageBox::Show( this, message, caption, buttons, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, MessageBoxOptions::RightAlign );
         if ( result == ::DialogResult::Yes )
         {
            // Closes the parent form.
            this->Close();
         }
      }
   }

private void validateUserEntry2()
{

    // Checks the value of the text.

    if(serverName.Text.Length == 0)
    {

        // Initializes the variables to pass to the MessageBox.Show method.

        string message = "You did not enter a server name. Cancel this operation?";
        string caption = "No Server Name Specified";
        MessageBoxButtons buttons = MessageBoxButtons.YesNo;
        DialogResult result;

        // Displays the MessageBox.

        result = MessageBox.Show(this, message, caption, buttons,
            MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, 
            MessageBoxOptions.RightAlign);

        if(result == DialogResult.Yes)
        {

            // Closes the parent form.

            this.Close();
        }
    }
}
Private Sub ValidateUserEntry2()


    ' Checks the value of the text.

    If ServerName.Text.Length = 0 Then

        ' Initializes variables to pass to the MessageBox.Show method.

        Dim Message As String = "You did not enter a server name. Cancel this operation?"
        Dim Caption As String = "No Server Name Specified"
        Dim Buttons As Integer = MessageBoxButtons.YesNo

        Dim Result As DialogResult

        'Displays a MessageBox using the Question icon and specifying the No button as the default.

        Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo, _
            MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign)


        ' Gets the result of the MessageBox display.

        If Result = System.Windows.Forms.DialogResult.Yes Then

            ' Closes the parent form.

            Me.Close()

        End If

    End If

End Sub

Açıklamalar

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

üzerinde MessageBoxyöntemleri çağırırken bir bağımsız değişken belirtmek istemiyorsanız, bunun yerine 0 geçirebilirsiniz.

Şunlara uygulanır