Hi!
I'm developing custom control with two panels. I'll make just onlyone panel have controls.
so, I used 'EnableDesignMode'. below is my code
[Designer(typeof(WPCTest.WPCTestDesigner))]
public partial class WPCTest : UserControl
{
public Panel Area { get { return this.panel2; } }
internal class WPCTestDesigner : ParentControlDesigner
{
public override void Initialize(IComponent component)
{
base.Initialize(component);
EnableDesignMode(((WPCTest)component).Area, "Area");
}
}
}
In Designer, user can design Form using custom control (for example, I added a Button into custom control).but, at run-time, the child controls of the custom control disappear.
so, I saw the generated code written by Windows Form Designer.
then, I found the factthat thechild controlswere generated but were not added into the ControlCollection of custom control.
below is the the generated code written by Windows Form Designer.
this.wpcTest1 = new WPCTest();
this.button1 = new System.Windows.Forms.Button();
// wpcTest1
//
this.wpcTest1.Location = new System.Drawing.Point(51, 23);
this.wpcTest1.Name = "wpcTest1";
this.wpcTest1.Size = new System.Drawing.Size(150, 150);
this.wpcTest1.TabIndex = 0;
I have never developed custom control. so, I have no idea about how to fix this problem.
Please help me.