MessageBoxOptions 열거형

정의

MessageBox옵션을 지정합니다.

이 열거형은 멤버 값의 비트 조합을 지원합니다.

public enum class MessageBoxOptions
[System.Flags]
public enum MessageBoxOptions
[<System.Flags>]
type MessageBoxOptions = 
Public Enum MessageBoxOptions
상속
MessageBoxOptions
특성

필드

Name Description
DefaultDesktopOnly 131072

현재 데스크톱에 메시지 상자가 표시됩니다. 이 상수는 시스템에서 대화형 창 스테이션의 기본 바탕 화면에만 메시지 상자를 표시한다는 점을 제외하고 유사 ServiceNotification합니다. 메시지 상자를 표시한 애플리케이션은 포커스가 손실되고 메시지 상자는 비주얼 스타일을 사용하지 않고 표시됩니다. 자세한 내용은 비주얼 스타일을 사용하여 컨트롤 렌더링을 참조하세요.

RightAlign 524288

메시지 상자 텍스트가 오른쪽에 맞춰집니다.

RtlReading 1048576

메시지 상자 텍스트가 오른쪽에서 왼쪽 읽기 순서로 표시되도록 지정합니다.

ServiceNotification 2097152

현재 데스크톱에 메시지 상자가 표시됩니다. 호출자는 사용자에게 이벤트를 알리는 서비스입니다. Show 는 컴퓨터에 로그온한 사용자가 없더라도 현재 활성 데스크톱에 메시지 상자를 표시합니다.

예제

다음 예제에서는 매개 변수를 MessageBox 포함하는 options 오버로드에서 지원하는 옵션을 사용하여 표시하는 방법을 보여 줍니다MessageBox.Show. 문자열 변수 ServerName가 비어 있는지 확인한 후 이 예제에서는 사용자에게 작업을 취소할 수 있는 옵션을 제공하는 질문 상자 아이콘을 표시 MessageBox 합니다. 이 예제에서는 열거형 멤버를 사용하여 MessageBoxOptions.RightAlign 텍스트가 대화 상자의 오른쪽 가장자리에 맞춰지도록 합니다. Show 메서드의 반환 값이 계산DialogResult.Yes되면 표시된 MessageBox 폼이 닫힙니다.

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

설명

이 열거형은 클래스에서 MessageBox 사용됩니다.

메서드 MessageBox를 호출할 때 인수를 지정하지 않으려면 대신 0으로 전달할 수 있습니다.

적용 대상