Reputation: 1157
I need help with the following issue: I have a panel inside of which I have placed a combobox and another panel. What I want is to show the child panel on top of the parent panel just like a combobox shows its items on top of its parent. Any way to achieve that?
Upvotes: 1
Views: 275
Reputation: 21979
Combobox
is composite control. Its popup part is in fact a popup window (similar to menu). It can even go outside of bounds of your form.
On your screenshot: child panel is a child of parent, so it will be automatically trimmed by parent bounds (or precisely, by parent client region bounds).
To go outside of parent panel, child panel should be a child of parent panel parent (to example, form), then, assuming z-order of child panel is bigger (use SendToFront()
), it will be drawn over parent panel and can go up to the bounds of its parent bounds.
It is possible to un-child control, by removing it from parent Controls
collection and adding it to some other parent collection, recalculating new Location
(use PointToScreen()
-> PointToClient()
combo, perhaps there is even single method for this).
If you think to go outside of form bounds to be more like combobox'ish, then you need to implement it as popup window (see, to example, here).
Upvotes: 1