0
我有一個自定義組件,其中包含其他組件的列表。VS2008:設計時嵌套自定義組件
如果我將一個子組件添加到列表中,它將顯示在與文檔大綱窗口中父組件相同的級別上。
我怎樣才能使它成爲父組件的子項? (類似於例如是一個TabControl的子項的TabPages)
這裏是我的代碼:
Public Class SomeComponent
Inherits Component
Public Sub New(ByVal cont As IContainer)
cont.Add(Me)
End Sub
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
<Editor("System.ComponentModel.Design.CollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", GetType(UITypeEditor))> _
Public ReadOnly Property Items() As List(Of SomeOtherComponent)
Get
If _items Is Nothing Then
_items = New List(Of SomeOtherComponent)
End If
Return _items
End Get
End Property
Private _items As List(Of SomeOtherComponent) = Nothing
End Class
Public Class SomeOtherComponent
Inherits Component
Public Sub New()
End Sub
Public Sub New(ByVal cont As IContainer)
cont.Add(Me)
End Sub
'...
End Class