Define irregularly shaped area in UserControl where controls may be dropped

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
 
O

Olaf Rabbachin

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
 
O

Olaf Rabbachin

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
 
N

nak

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

nak

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top