Define irregularly shaped area in UserControl where controls may be dropped

  • Thread starter Thread starter Olaf Rabbachin
  • Start date Start date
O

Olaf Rabbachin

Hi folks,

I have a UserControl that consists of two areas - a header and a content
area. Users are to drop controls only in the content area. While this
wouldn't be much of a problem if I added i.e. a panel control, the
resulting content area would be a rectangle.
However, the content area can be irregularly shaped.
Also, since the UserControl itself is already a ContainerControl, adding a
panel comes with some overhead as I need to call EnableDesignMode() for
that panel, resulting in an additional property for the control where
controls are added by the WinForms designer (i.e.
<MyUserControl.ContentArea> instead of <MyUserControl>).
I guess it should actually be possible to directly place child controls in
the UserControl itself and still be able to restrict the content area.

Any pointers?

To further clarify the issue:
The real problem with a rectangular client area is simply the fact that, if
you drop a control into the content area (which itself is not rectangular)
and move it to its edges, that control would overlap the content area
(which is being painted inside).
Here's a little sample image of what this could look like:
http://www.intuidev.de/otherstuff/ContainerControlProblem.png
Here, the textbox is "out of bounds" and I can't seem to find a way of
dealing with this. :-(

Cheers,
Olaf
 
Hi,
The Region API is what you need to use.

how could I have missed a simple ...
~MyContentArea.Region = TheRegionForControls

Can't believe I spent *hours* trying to find that missing piece.
Thanks bunches!

Cheers,
Olaf
 
Hi,
The Region API is what you need to use.

how could I have missed a simple ...
~MyContentArea.Region = TheRegionForControls

Can't believe I spent *hours* trying to find that missing piece.
Thanks bunches!

Cheers,
Olaf
 
Hey,
how could I have missed a simple ...
~MyContentArea.Region = TheRegionForControls

Can't believe I spent *hours* trying to find that missing piece.
Thanks bunches!

haha no probs! I spend enough time doing that also :)

Nick.
 
Hey,
how could I have missed a simple ...
~MyContentArea.Region = TheRegionForControls

Can't believe I spent *hours* trying to find that missing piece.
Thanks bunches!

haha no probs! I spend enough time doing that also :)

Nick.
 
Back
Top