ToolboxItem.CreateComponentsCore 메서드

정의

도구 상자 항목이 호출될 때 구성 요소 한 개나 구성 요소의 배열을 만듭니다.

오버로드

CreateComponentsCore(IDesignerHost)

도구 상자 항목이 호출될 때 구성 요소 한 개나 구성 요소의 배열을 만듭니다.

CreateComponentsCore(IDesignerHost, IDictionary)

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

CreateComponentsCore(IDesignerHost)

도구 상자 항목이 호출될 때 구성 요소 한 개나 구성 요소의 배열을 만듭니다.

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

매개 변수

host
IDesignerHost

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

반환

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

설명

이 아닌 null경우 host 메서드는 CreateComponentsCore 디자이너에 새 구성 요소를 추가합니다.

상속자 참고

도구 상자 항목이 CreateComponentsCore(IDesignerHost) 만드는 구성 요소 또는 구성 요소를 반환하도록 메서드를 재정의할 수 있습니다.

추가 정보

적용 대상

CreateComponentsCore(IDesignerHost, IDictionary)

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

protected:
 virtual cli::array <System::ComponentModel::IComponent ^> ^ CreateComponentsCore(System::ComponentModel::Design::IDesignerHost ^ host, System::Collections::IDictionary ^ defaultValues);
protected virtual System.ComponentModel.IComponent[] CreateComponentsCore (System.ComponentModel.Design.IDesignerHost host, System.Collections.IDictionary defaultValues);
protected virtual System.ComponentModel.IComponent[]? CreateComponentsCore (System.ComponentModel.Design.IDesignerHost? host, System.Collections.IDictionary? defaultValues);
abstract member CreateComponentsCore : System.ComponentModel.Design.IDesignerHost * System.Collections.IDictionary -> System.ComponentModel.IComponent[]
override this.CreateComponentsCore : System.ComponentModel.Design.IDesignerHost * System.Collections.IDictionary -> System.ComponentModel.IComponent[]
Protected Overridable Function CreateComponentsCore (host As IDesignerHost, defaultValues As IDictionary) As IComponent()

매개 변수

host
IDesignerHost

구성 요소를 만들 때 사용할 디자이너 호스트입니다.

defaultValues
IDictionary

구성 요소의 초기화에 사용할 기본값의 속성 이름/값 쌍 사전입니다.

반환

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

예제

다음 코드 예제에서는 사용자 지정 도구 상자 항목 구현에 대 한 에서 파생 된 클래스에서 ToolboxItem 메서드를 사용 CreateComponentsCore 하는 방법을 보여 줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 ToolboxItem 클래스입니다.

protected override IComponent[] CreateComponentsCore(
    System.ComponentModel.Design.IDesignerHost host, 
    System.Collections.IDictionary defaultValues)
{
    // Get the string we want to fill in the custom
    // user control.  If the user cancels out of the dialog,
    // return null or an empty array to signify that the 
    // tool creation was canceled.
    using (ToolboxItemDialog d = new ToolboxItemDialog())
    {
        if (d.ShowDialog() == DialogResult.OK)
        {
            string text = d.CreationText;

            IComponent[] comps =
                base.CreateComponentsCore(host, defaultValues);
            // comps will have a single component: our data type.
            ((UserControl1)comps[0]).LabelText = text;
            return comps;
        }
        else
        {
            return null;
        }
    }
}
Protected Overrides Function CreateComponentsCore( _
    ByVal host As System.ComponentModel.Design.IDesignerHost, _
    ByVal defaultValues As System.Collections.IDictionary) _
    As IComponent()
    ' Get the string we want to fill in the custom
    ' user control.  If the user cancels out of the dialog,
    ' return null or an empty array to signify that the 
    ' tool creation was canceled.
    Using d As New ToolboxItemDialog()
        If d.ShowDialog() = DialogResult.OK Then
            Dim [text] As String = d.CreationText
            Dim comps As IComponent() = _
                MyBase.CreateComponentsCore(host, defaultValues)
            ' comps will have a single component: our data type.
            CType(comps(0), UserControl1).LabelText = [text]
            Return comps
        Else
            Return Nothing
        End If
    End Using
End Function

설명

이 아닌 null경우 host 메서드는 CreateComponentsCore 디자이너에 새 구성 요소를 추가합니다.

적용 대상