I've created a Control class and have added the
System.ComponentModel.DesignerAttribute attribute to make the Control object
act as a control container at design-time.

[Designer("System.Windows.Forms.Design.ParentControlDesigner,
System.Design", typeof(IDesigner))]
public class MyContainerControl : System.Windows.Forms.Control
{
.
.
.
}

This works fine, but it allows the developer to put controls anywhere they
want inside the control container. I want to restrict this, so that controls
can only be positioned within a defined area inside the container control.

Can someone please show me an example on how to do this?
Thank you.

Re: Container Control Question by Michael

Michael
Wed Jun 14 06:56:47 CDT 2006

Hi,
To make your control a proper container you should have t inherit from
ContainerControl If you do this then you can get this.Controls which will
allow you to check each of your child controls individually to see if they
are in the desired area.

--
Mike Powell
Ramuseco Limited
www.ramuseco.com
"Mark Collard" <Mark Collard@discussions.microsoft.com> wrote in message
news:8965C3B8-0D7E-4420-8D37-BA96A327DA2E@microsoft.com...
> I've created a Control class and have added the
> System.ComponentModel.DesignerAttribute attribute to make the Control
> object
> act as a control container at design-time.
>
> [Designer("System.Windows.Forms.Design.ParentControlDesigner,
> System.Design", typeof(IDesigner))]
> public class MyContainerControl : System.Windows.Forms.Control
> {
> .
> .
> .
> }
>
> This works fine, but it allows the developer to put controls anywhere they
> want inside the control container. I want to restrict this, so that
> controls
> can only be positioned within a defined area inside the container control.
>
> Can someone please show me an example on how to do this?
> Thank you.



Re: Container Control Question by MarkCollard

MarkCollard
Thu Jun 15 10:11:01 CDT 2006

Thanks. I'll give that ago.

Regards
Mark

"Michael Powell" wrote:

> Hi,
> To make your control a proper container you should have t inherit from
> ContainerControl If you do this then you can get this.Controls which will
> allow you to check each of your child controls individually to see if they
> are in the desired area.
>
> --
> Mike Powell
> Ramuseco Limited
> www.ramuseco.com
> "Mark Collard" <Mark Collard@discussions.microsoft.com> wrote in message
> news:8965C3B8-0D7E-4420-8D37-BA96A327DA2E@microsoft.com...
> > I've created a Control class and have added the
> > System.ComponentModel.DesignerAttribute attribute to make the Control
> > object
> > act as a control container at design-time.
> >
> > [Designer("System.Windows.Forms.Design.ParentControlDesigner,
> > System.Design", typeof(IDesigner))]
> > public class MyContainerControl : System.Windows.Forms.Control
> > {
> > .
> > .
> > .
> > }
> >
> > This works fine, but it allows the developer to put controls anywhere they
> > want inside the control container. I want to restrict this, so that
> > controls
> > can only be positioned within a defined area inside the container control.
> >
> > Can someone please show me an example on how to do this?
> > Thank you.
>
>
>

Re: Container Control Question by PIEBALD

PIEBALD
Thu Oct 04 08:23:03 PDT 2007

I'm trying to do something similar; I want to derive from TabPage, but use a
ParentControlDesigner (or similar) for it. (At the moment I use a UserControl
and add that control to a TabPage, but if possible, I'd like to remove that
step.)

The snippet in the original post didn't seem to work for me.

I'm using VS 2005