我有一个自定义控件,该控件有一个属性集合。
我想拖动我的控件,自动添加对象到我的控件的集合属性中。
像TabControl.TabPages auto code.When拖拽TabControl到表单一样,auto create 2 TabPage add in TabControl.TabPages。
我该怎么做呢?
发布于 2013-04-01 16:00:19
对于TabControl,您应该像这样使用自定义设计器:
[Designer("System.Windows.Forms.Design.TabControlDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
...
public class TabControl : Control
{
....
}TabControlDesigner提供了这两个默认选项卡:
internal class TabControlDesigner : ParentControlDesigner
{
public override void InitializeNewComponent(IDictionary defaultValues)
{
base.InitializeNewComponent(defaultValues);
try
{
this.addingOnInitialize = true;
this.OnAdd((object) this, EventArgs.Empty);
this.OnAdd((object) this, EventArgs.Empty);
...https://stackoverflow.com/questions/15738377
复制相似问题