MessageBoxOptions 열거형

정의

MessageBox의 옵션을 지정합니다.

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

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

필드

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을 전달할 수 있습니다.

적용 대상