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

cnordvik

Newcomer
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.

I've made the control and used the parentcontroldesigner class to implement a designer. But the control doesn't 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 aren't visible, just the container control.

I've searched all over MSDN and these forums and still haven't 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 I'm trying to do. The button is in front just because I've 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).

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

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