Composite control components that are not clipped?

I am creating a composite control. It has Height equal to a combo box. i.e. One line or 21 pixels.

If I place a combo box in the control, I can click the down arrow and the list is displayed beneath the combo's text box as expected.

My question is, how do I get the same behaviour if I am constructing my own control based on, for example, a text box and a list  If I have my user control Height set to 21, I cannot see the list as it is (apparently) clipped by the user control itself.

What do I have to do in a composite control to get a contained control to become visible outside the area of the composite control

Thanks,

Julian


Answer this question

Composite control components that are not clipped?

  • adz2006

    I typically tie the height of the user control to the height of the child control. For example, in the .ReSize() event of the child control, add something like:

    Me.Height = myChildControl.Height


  • Tom Servo

    Thanks for your reply. The problem with tying the height to the child control is that you can't position another control directly underneath it. Imagine if you had to allow space under every combo box for the list to drop down.

    What I have discovered is that I can set the Parent property of the child control to the TopLevelControl of my User Control. This is the Form itself. I have to do some fiddling about to get the Top and Left correct but it does what I want. The child is then only clipped by the form.

    Julian

  • Composite control components that are not clipped?