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 / Design Time / March 2005

Tip: Looking for answers? Try searching our database.

Multiple containers on UserControl

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bram - 11 Mar 2005 11:32 GMT
Hello,

I've created a UserControl that contains several panels. However, when
I drop a Control onto one of these panels, the Control will be added to
the parent UserControl and not to the Panel itself.

I've read some topics on these subject but all these topics describe
how to offer only one Panel, while I want to add more just like - for
instance - the SplitContainer in the VS 2005 Beta.

How do I do this?
Any pointers would be greatly appreciated,

Bram
Bram - 12 Mar 2005 17:02 GMT
For those who are looking for the answer - I found it out myself.
Actually it's quite easy. All you have to do is create a custom
designer that derives of ParentControlDesigner. This Designer has a
method EnableDesignMode that allows enabling the DesignMode for sibling
controls.

using System.Windows.Forms.Design;

[Designer(typeof(MyUserControlDesigner))]
public class MyUserControl : UserControl {
 [ ... ]

 public Panel Panel1 {
 }

 public Panel Panel2 {
 }

}

public class MyUserControlDesigner: ParentControlDesigner {
 public override void Initialize(System.ComponentModel.IComponent
component) {
   base.Initialize(component);
   MyUserControl uc = component as MyUserControl;
   EnableDesignMode(uc.Label1, uc.Label1.Name);
   EnableDesignMode(uc.Label2, uc.Label2.Name);
 }
}
joeycalisay - 14 Mar 2005 02:15 GMT
This is for .NET 2.0 probably...

Signature

Joey Calisay
http://spaces.msn.com/members/joeycalisay/

> For those who are looking for the answer - I found it out myself.
> Actually it's quite easy. All you have to do is create a custom
[quoted text clipped - 25 lines]
>   }
> }
Bram - 14 Mar 2005 03:33 GMT
Yeah I'm afraid it is. I'm not sure if there's a different way to do it
in 1.0 or 1.1 but I highly doubt it because if there was there would be
no excuse for the horrendous way the SplitterBar control works.

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.