IUIService.ShowMessage 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在消息框中显示指定的消息。
重载
| 名称 | 说明 |
|---|---|
| ShowMessage(String) |
在消息框中显示指定的消息。 |
| ShowMessage(String, String) |
在具有指定标题的消息框中显示指定的消息。 |
| ShowMessage(String, String, MessageBoxButtons) |
在消息框中显示指定的消息,其中包含要放置在对话框中的指定标题和按钮。 |
ShowMessage(String)
- Source:
- IUIService.cs
- Source:
- IUIService.cs
- Source:
- IUIService.cs
- Source:
- IUIService.cs
- Source:
- 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)
- Source:
- IUIService.cs
- Source:
- IUIService.cs
- Source:
- IUIService.cs
- Source:
- IUIService.cs
- Source:
- 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)
- Source:
- IUIService.cs
- Source:
- IUIService.cs
- Source:
- IUIService.cs
- Source:
- IUIService.cs
- Source:
- 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
注解
此方法可确保消息框的显示与开发环境正确集成。