Share via


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

適用於

另請參閱