IDesignerHost.CreateComponent 方法

定義

建立指定類型的元件並將其加入設計文件中。

多載

名稱 Description
CreateComponent(Type)

建立指定類型的元件並將其加入設計文件中。

CreateComponent(Type, String)

建立指定類型與名稱的元件,並將其加入設計文件中。

CreateComponent(Type)

建立指定類型的元件並將其加入設計文件中。

public:
 System::ComponentModel::IComponent ^ CreateComponent(Type ^ componentClass);
public System.ComponentModel.IComponent CreateComponent(Type componentClass);
abstract member CreateComponent : Type -> System.ComponentModel.IComponent
Public Function CreateComponent (componentClass As Type) As IComponent

參數

componentClass
Type

要建立的元件類型。

傳回

新創造的元件。

備註

若型別無法解析成實 IComponent作 的物件,則會拋出例外。

此方法未指定元件名稱。 該方法建立元件並將其加入設計容器。

另請參閱

適用於

CreateComponent(Type, String)

建立指定類型與名稱的元件,並將其加入設計文件中。

public:
 System::ComponentModel::IComponent ^ CreateComponent(Type ^ componentClass, System::String ^ name);
public System.ComponentModel.IComponent CreateComponent(Type componentClass, string name);
abstract member CreateComponent : Type * string -> System.ComponentModel.IComponent
Public Function CreateComponent (componentClass As Type, name As String) As IComponent

參數

componentClass
Type

要建立的元件類型。

name
String

元件的名稱。

傳回

新創造的元件。

備註

若型別無法解析成實 IComponent作 的物件,則會拋出例外。

此方法建立元件並將其加入設計容器。

另請參閱

適用於