IUIService.ShowDialog(Form) 方法

定义

尝试在对话框中显示指定的窗体。

public:
 System::Windows::Forms::DialogResult ShowDialog(System::Windows::Forms::Form ^ form);
public System.Windows.Forms.DialogResult ShowDialog (System.Windows.Forms.Form form);
abstract member ShowDialog : System.Windows.Forms.Form -> System.Windows.Forms.DialogResult
Public Function ShowDialog (form As Form) As DialogResult

参数

form
Form

要显示的 Form

返回

DialogResult 值之一,指示由对话框返回的结果代码。

示例

下面的代码示例尝试获取 类的 IUIService 实例并调用服务的 ShowDialog 方法。

IUIService^ UIservice = dynamic_cast<IUIService^>(this->GetService( System::Windows::Forms::Design::IUIService::typeid ));
if ( UIservice != nullptr )
      UIservice->ShowDialog( gcnew ExampleForm );
IUIService UIservice = (IUIService)this.GetService( 
    typeof( System.Windows.Forms.Design.IUIService ) );
if( UIservice != null )            
    UIservice.ShowDialog(new ExampleForm());
Dim UIservice As IUIService = CType(Me.GetService( _
    GetType(System.Windows.Forms.Design.IUIService)), IUIService)
If (UIservice IsNot Nothing) Then
    UIservice.ShowDialog(New ExampleForm())
End If

适用于

另请参阅