MessageBoxOptions 列挙体
この列挙体には、メンバ値のビットごとの組み合わせを可能にする FlagsAttribute 属性が含まれています。
名前空間: System.Windows.Formsアセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

<FlagsAttribute> _ Public Enumeration MessageBoxOptions

メンバ名 | 説明 | |
---|---|---|
DefaultDesktopOnly | メッセージ ボックスをアクティブ デスクトップに表示します。 この定数は、システムが対話形式のウィンドウ ステーションの既定のデスクトップだけにメッセージ ボックスを表示することを除いて、ServiceNotification と同じです。 DefaultDesktopOnly を指定すると、MessageBox を発生させたアプリケーションがフォーカスを失います。表示されている MessageBox は、visual スタイルを使用しません。詳細については、「visual スタイルが使用されているコントロールのレンダリング」を参照してください。 | |
RightAlign | メッセージ ボックスのテキストを右揃えで表示します。 | |
RtlReading | メッセージ ボックスのテキストを右から左へ読むように指定します。 | |
ServiceNotification | メッセージ ボックスをアクティブ デスクトップに表示します。 呼び出し元は、ユーザーにイベントを通知するサービスです。この関数は、コンピュータにログオンしているユーザーがいない場合でも、現在のアクティブ デスクトップにメッセージ ボックスを表示します。 |


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 = DialogResult.Yes Then ' Closes the parent form. Me.Close() End If End If End Sub
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: 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.get_Text().get_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.Equals(DialogResult.Yes)) { // Closes the parent form. this.Close(); } } } //ValidateUserEntry2

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- MessageBoxOptions 列挙体のページへのリンク