How to make a usercontrol that acts as a container for other controls?

cnordvik

Member
Joined
May 2, 2003
Messages
5
I am developing a custom usercontrol that is really just a panel with two images on top and a drop down menu.

The panel is divided into two parts, the top where the images are and the rest where the user should be able to drop controls.

Ive made the control and used the parentcontroldesigner class to implement a designer. But the control doesnt behave correctly at all.

Design mode: The controls that are added are placed behind the control and I must use "bring to front" to see them correctly.

Run mode: The added controls arent visible, just the container control.

Ive searched all over MSDN and these forums and still havent found something that I can use.

Any help would be greatly appreciated!

Best regards,

Christer Nordvik


Here is a picture of the design mode to illustrate what Im trying to do. The button is in front just because Ive used "bring to front".
 

Attachments

You screwed something up somewhere. Simply applying the below attribute to your usercontrol class will make it behave like a control container (like a Panel).

Code:
<System.ComponentModel.Designer(GetType(System.Windows.Forms.Design.ParentControlDesigner))>

C#:
[System.ComponentModel.Designer(typeof(System.Windows.Forms.Design.ParentControlDesigner))]
 
Back
Top