Hello,
I've created a UserControl that contains several panels. However, when
I drop a Control onto one of these panels, the Control will be added to
the parent UserControl and not to the Panel itself.
I've read some topics on these subject but all these topics describe
how to offer only one Panel, while I want to add more just like - for
instance - the SplitContainer in the VS 2005 Beta.
How do I do this?
Any pointers would be greatly appreciated,
Bram
Bram - 12 Mar 2005 17:02 GMT
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);
}
}
joeycalisay - 14 Mar 2005 02:15 GMT
This is for .NET 2.0 probably...

Signature
Joey Calisay
http://spaces.msn.com/members/joeycalisay/
> 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
[quoted text clipped - 25 lines]
> }
> }
Bram - 14 Mar 2005 03:33 GMT
Yeah I'm afraid it is. I'm not sure if there's a different way to do it
in 1.0 or 1.1 but I highly doubt it because if there was there would be
no excuse for the horrendous way the SplitterBar control works.