Hi Rich,
Thanks for your post.
Based on my understanding, you want to expose an inner Panel control in the
UserControl level, so that in Form/UserControl designer, we can directly
drop another control onto this inner panel, and IDE will generate code to
add this control into Panel.Controls collection. If I misunderstand you,
please feel free to tell me, thanks
Yes, this is a design-time limitation of VS.net2003, which has finally been
added in VS2005.
In VS2005, winform designer released INestedContainer interface, which
encapsulate this function. We can just create a new ControlDesigner, then
in its Initialize method, use ControlDesigner.EnableDesignMode to enable
this inner Panel control's design mode function.
Sample code listed below:
public class MyPanelControlDesigner: ControlDesigner
{
public override void Initialize(IComponent c)
{
base.Initialize(c);
UserControl1 ctl = (UserControl1)c;
EnableDesignMode(ctl.MyPanel, "MyPanel");
}
}
[Designer(typeof(MyPanelControlDesigner))]
partial class UserControl1
{
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public System.Windows.Forms.Panel MyPanel
{
get
{
return this.panel1;
}
set
{
this.panel1=value;
}
}
}
This works well on my side. Hope it helps
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Rich - 24 Nov 2005 18:33 GMT
Hello Jeffrey Tan[MSFT],
You're the man. This is exactly what I was hoping for. I will implement
this and let you know if I run into any issues.
> Hi Rich,
>
[quoted text clipped - 48 lines]
> This posting is provided "as is" with no warranties and confers no
> rights.
"Jeffrey Tan[MSFT]" - 25 Nov 2005 03:22 GMT
You are welcome. If you have further issue, please feel free to post. Thanks
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Rich - 25 Nov 2005 19:22 GMT
Hello Jeffrey Tan[MSFT],
Everything worked as described. Just one follow-up. A reference to System.Design
needs to be made in order for the ControlDesigner class to be recognized
in the System.Windows.Forms.Design namespace. Just thought I would add to
this thread to save everyone else a few minutes.
Rich
> You are welcome. If you have further issue, please feel free to post.
> Thanks
[quoted text clipped - 5 lines]
> This posting is provided "as is" with no warranties and confers no
> rights
"Jeffrey Tan[MSFT]" - 28 Nov 2005 03:50 GMT
Hi Rich,
Thanks for your sharing.
Yes, normally, when we want to use a class, we can search it in MSDN, then
in the bottom of the class reference, MSDN will list the assembly
containing the class and the namespace it resides in.
Thanks
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
The_Assimilator - 10 Jan 2006 12:14 GMT
Another important fact is that the ControlDesigner.EnableDesignMode()
method is only available with .NET 2.0 - it took me a few frustrating
hours to figure this out ;/.
"Jeffrey Tan[MSFT]" - 25 Nov 2005 03:22 GMT
You are welcome. If you have further issue, please feel free to post. Thanks
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.