Share via


ToolboxItem.CreateComponentsCore Yöntem

Tanım

Araç kutusu öğesi çağrıldığında bir bileşen veya bileşen dizisi oluşturur.

Aşırı Yüklemeler

CreateComponentsCore(IDesignerHost)

Araç kutusu öğesi çağrıldığında bir bileşen veya bileşen dizisi oluşturur.

CreateComponentsCore(IDesignerHost, IDictionary)

Araç kutusu öğesi çağrıldığında bir bileşen dizisi oluşturur.

CreateComponentsCore(IDesignerHost)

Araç kutusu öğesi çağrıldığında bir bileşen veya bileşen dizisi oluşturur.

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()

Parametreler

host
IDesignerHost

IDesignerHost Araç kutusu öğesini barındırmak için.

Döndürülenler

Oluşturulan IComponent nesneler dizisi.

Açıklamalar

değilse hostnullCreateComponentsCore, yöntemi yeni bileşenleri tasarımcıya ekler.

Devralanlara Notlar

Bir araç kutusu öğesinin CreateComponentsCore(IDesignerHost) oluşturduğu bileşeni veya bileşenleri döndürmek için yöntemini geçersiz kılabilirsiniz.

Ayrıca bkz.

Şunlara uygulanır

CreateComponentsCore(IDesignerHost, IDictionary)

Araç kutusu öğesi çağrıldığında bir bileşen dizisi oluşturur.

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()

Parametreler

host
IDesignerHost

Bileşen oluştururken kullanılacak tasarımcı konağı.

defaultValues
IDictionary

Bileşenin başlatıldığı varsayılan değerlerin özellik adı/değer çiftlerinin sözlüğü.

Döndürülenler

Oluşturulan IComponent nesneler dizisi.

Örnekler

Aşağıdaki kod örneği, özel bir araç kutusu öğesi uygulaması için öğesinden ToolboxItem türetilen bir sınıfta yönteminin kullanımını CreateComponentsCore gösterir. Bu kod örneği, sınıfı için ToolboxItem sağlanan daha büyük bir örneğin parçasıdır.

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

Açıklamalar

değilse hostnullCreateComponentsCore, yöntemi yeni bileşenleri tasarımcıya ekler.

Şunlara uygulanır