IUIService.ShowMessage 方法

定义

在消息框中显示指定的消息。

重载

ShowMessage(String)

在消息框中显示指定的消息。

ShowMessage(String, String)

用指定的标题在消息框中显示指定的消息。

ShowMessage(String, String, MessageBoxButtons)

用指定的标题和要在对话框上放置的按钮在消息框中显示指定的消息。

ShowMessage(String)

在消息框中显示指定的消息。

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)

用指定的标题在消息框中显示指定的消息。

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)

用指定的标题和要在对话框上放置的按钮在消息框中显示指定的消息。

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

用于对话框的标题。

返回

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

注解

此方法可确保消息框的显示与开发环境正确集成。

另请参阅

适用于