Hello,

I'd like to create a custom control that exposes several containers,
much like the SplitContainer in VS 2005. However, when I create a
custom control with several panels and I drag a control onto the custom
control, it will become part of that custom control and not part of the
Panel that's on the custom control.

How do I change this behaviour?

Thanks in advance for any info,
Bram

Re: Creating a custom container control by joeycalisay

joeycalisay
Thu Mar 10 20:10:07 CST 2005

this has been discussed a number of times at the designtime ng, try to
search there...

--
Joey Calisay
http://spaces.msn.com/members/joeycalisay/


<bram@fokke.net> wrote in message
news:1110502003.124389.39920@f14g2000cwb.googlegroups.com...
> Hello,
>
> I'd like to create a custom control that exposes several containers,
> much like the SplitContainer in VS 2005. However, when I create a
> custom control with several panels and I drag a control onto the custom
> control, it will become part of that custom control and not part of the
> Panel that's on the custom control.
>
> How do I change this behaviour?
>
> Thanks in advance for any info,
> Bram
>



Re: Creating a custom container control by Bram

Bram
Sat Mar 12 10:39:28 CST 2005

For those who are looking for the answer - I found it out myself.
Actually it's quite easy. All you have to do is create a custom
designer that derives of ParentControlDesigner. This Designer has a
method EnableDesignMode that allows enabling the DesignMode for sibling
controls.

using System.Windows.Forms.Design;

[Designer(typeof(MyUserControlDesigner))]
public class MyUserControl : UserControl {
[ ... ]

public Panel Panel1 {
}

public Panel Panel2 {
}
}


public class MyUserControlDesigner: ParentControlDesigner {
public override void Initialize(System.ComponentModel.IComponent
component) {
base.Initialize(component);
MyUserControl uc = component as MyUserControl;
EnableDesignMode(uc.Label1, uc.Label1.Name);
EnableDesignMode(uc.Label2, uc.Label2.Name);
}
}