다음을 통해 공유


ActivityToolboxItem.CreateComponentsCore(IDesignerHost) 메서드

정의

도구 상자 항목이 호출될 때 Activity 구성 요소 또는 Activity 구성 요소의 배열을 만듭니다.

protected:
 override cli::array <System::ComponentModel::IComponent ^> ^ CreateComponentsCore(System::ComponentModel::Design::IDesignerHost ^ host);
protected override System.ComponentModel.IComponent[] CreateComponentsCore (System.ComponentModel.Design.IDesignerHost host);
override this.CreateComponentsCore : System.ComponentModel.Design.IDesignerHost -> System.ComponentModel.IComponent[]
Protected Overrides Function CreateComponentsCore (host As IDesignerHost) As IComponent()

매개 변수

host
IDesignerHost

도구 상자 항목을 호스팅할 IDesignerHost입니다.

반환

IComponent[]

생성된 IComponent 개체 배열입니다.

예제

다음 예제에서는 사용자 지정 활동의 전체 ActivityToolboxItem 클래스를 보여 줍니다. 이 예제의 경우 CreateComponentsCore 메서드는 ParallelActivity 내에 두 개의 사용자 지정 활동을 삽입하기 위해 재지정됩니다.

[Serializable]
internal sealed class CustomActivityToolboxItem : ActivityToolboxItem
{
    public CustomActivityToolboxItem(Type type)
        : base(type)
    {
    }

    private CustomActivityToolboxItem(SerializationInfo info, StreamingContext context)
    {
        Deserialize(info, context);
    }

    protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
    {
        CompositeActivity parallel = new ParallelActivity();
        parallel.Activities.Add(new CustomActivity());
        parallel.Activities.Add(new CustomActivity());

        return new IComponent[] { parallel };
    }
}
<Serializable()> _
Friend Class CustomActivityToolboxItem
    Inherits ActivityToolboxItem

    Public Sub New(ByVal type As Type)
        MyBase.new(type)
    End Sub

    Private Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
        Deserialize(info, context)
    End Sub

    Protected Overrides Function CreateComponentsCore(ByVal designerHost As IDesignerHost) As IComponent()
        Dim parallel As New ParallelActivity()
        parallel.Activities.Add(New CustomActivity())
        parallel.Activities.Add(New CustomActivity())

        Return New IComponent() {parallel}
    End Function
End Class

설명

CreateComponentsCore 메서드는 ActivityToolboxItem이 만든 구성 요소를 반환합니다.

적용 대상