Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / October 2007

Tip: Looking for answers? Try searching our database.

Container Control Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark Collard - 13 Jun 2006 12:35 GMT
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.
Michael Powell - 14 Jun 2006 12:56 GMT
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.

Signature

Mike Powell
Ramuseco Limited
www.ramuseco.com

> I've created a Control class and have added the
> System.ComponentModel.DesignerAttribute attribute to make the Control
[quoted text clipped - 17 lines]
> Can someone please show me an example on how to do this?
> Thank you.
Mark Collard - 15 Jun 2006 16:11 GMT
Thanks. I'll give that ago.

Regards
Mark

> Hi,
> To make your control a proper container you should have t inherit from
[quoted text clipped - 23 lines]
> > Can someone please show me an example on how to do this?
> > Thank you.
PIEBALD - 04 Oct 2007 16:23 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.