語言

IUIService.ShowMessage 方法

定義

在訊息框中顯示指定的訊息。

多載

名稱 Description
ShowMessage(String)

在訊息框中顯示指定的訊息。

ShowMessage(String, String)

在訊息框中顯示指定的訊息,並附上指定的說明文字。

ShowMessage(String, String, MessageBoxButtons)

在訊息框中顯示指定的訊息,並附上指定的說明文字和按鈕,供你放置於對話框上。

ShowMessage(String)

來源:
IUIService.cs
來源:
IUIService.cs
來源:
IUIService.cs
來源:
IUIService.cs
來源:
IUIService.cs

在訊息框中顯示指定的訊息。

public:
 void ShowMessage(System::String ^ message);
public void ShowMessage(string message);
abstract member ShowMessage : string -> unit
Public Sub ShowMessage (message As String)

參數

message
String

要顯示的訊息。

範例

以下程式碼範例示範如何使用此 ShowMessage 方法來顯示訊息框。

IUIService^ UIservice = dynamic_cast<IUIService^>(this->GetService( System::Windows::Forms::Design::IUIService::typeid ));
if ( UIservice != nullptr )
      UIservice->ShowMessage( "Test message", "Test caption", System::Windows::Forms::MessageBoxButtons::AbortRetryIgnore );
IUIService UIservice = (IUIService)this.GetService( 
    typeof( System.Windows.Forms.Design.IUIService ) );
if( UIservice != null )            
    UIservice.ShowMessage("Test message", "Test caption", 
        System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore);
Dim UIservice As IUIService = CType(Me.GetService( _
    GetType(System.Windows.Forms.Design.IUIService)), IUIService)
If (UIservice IsNot Nothing) Then
    UIservice.ShowMessage("Test message", "Test caption", _
        System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore)
End If

備註

此方法確保訊息框的顯示與開發環境妥善整合。

適用於

ShowMessage(String, String)

來源:
IUIService.cs
來源:
IUIService.cs
來源:
IUIService.cs
來源:
IUIService.cs
來源:
IUIService.cs

在訊息框中顯示指定的訊息,並附上指定的說明文字。

public:
 void ShowMessage(System::String ^ message, System::String ^ caption);
public void ShowMessage(string message, string caption);
abstract member ShowMessage : string * string -> unit
Public Sub ShowMessage (message As String, caption As String)

參數

message
String

要顯示的訊息。

caption
String

訊息框的說明文字。

範例

以下程式碼範例嘗試取得 並 IUIService 呼叫服務 ShowMessage 方法的實例。

IUIService^ UIservice = dynamic_cast<IUIService^>(this->GetService( System::Windows::Forms::Design::IUIService::typeid ));
if ( UIservice != nullptr )
      UIservice->ShowMessage( "Test message", "Test caption", System::Windows::Forms::MessageBoxButtons::AbortRetryIgnore );
IUIService UIservice = (IUIService)this.GetService( 
    typeof( System.Windows.Forms.Design.IUIService ) );
if( UIservice != null )            
    UIservice.ShowMessage("Test message", "Test caption", 
        System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore);
Dim UIservice As IUIService = CType(Me.GetService( _
    GetType(System.Windows.Forms.Design.IUIService)), IUIService)
If (UIservice IsNot Nothing) Then
    UIservice.ShowMessage("Test message", "Test caption", _
        System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore)
End If

備註

此方法確保訊息框的顯示與開發環境妥善整合。

適用於

ShowMessage(String, String, MessageBoxButtons)

來源:
IUIService.cs
來源:
IUIService.cs
來源:
IUIService.cs
來源:
IUIService.cs
來源:
IUIService.cs

在訊息框中顯示指定的訊息,並附上指定的說明文字和按鈕,供你放置於對話框上。

public:
 System::Windows::Forms::DialogResult ShowMessage(System::String ^ message, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons);
public System.Windows.Forms.DialogResult ShowMessage(string message, string caption, System.Windows.Forms.MessageBoxButtons buttons);
abstract member ShowMessage : string * string * System.Windows.Forms.MessageBoxButtons -> System.Windows.Forms.DialogResult
Public Function ShowMessage (message As String, caption As String, buttons As MessageBoxButtons) As DialogResult

參數

message
String

要顯示的訊息。

caption
String

對話框的說明文字。

buttons
MessageBoxButtons

其中一個值為 MessageBoxButtons : OK、、 OKCancel、 YesNo或 YesNoCancel。

傳回

DialogResult其中一個值表示對話框回傳的結果代碼。

範例

以下程式碼範例示範如何使用此 ShowMessage 方法來顯示訊息框。

IUIService^ UIservice = dynamic_cast<IUIService^>(this->GetService( System::Windows::Forms::Design::IUIService::typeid ));
if ( UIservice != nullptr )
      UIservice->ShowMessage( "Test message", "Test caption", System::Windows::Forms::MessageBoxButtons::AbortRetryIgnore );
IUIService UIservice = (IUIService)this.GetService( 
    typeof( System.Windows.Forms.Design.IUIService ) );
if( UIservice != null )            
    UIservice.ShowMessage("Test message", "Test caption", 
        System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore);
Dim UIservice As IUIService = CType(Me.GetService( _
    GetType(System.Windows.Forms.Design.IUIService)), IUIService)
If (UIservice IsNot Nothing) Then
    UIservice.ShowMessage("Test message", "Test caption", _
        System.Windows.Forms.MessageBoxButtons.AbortRetryIgnore)
End If

備註

此方法確保訊息框的顯示與開發環境妥善整合。

另請參閱

適用於