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 / June 2004

Tip: Looking for answers? Try searching our database.

Designer problem:  with it I can add controls to control, with it I can't

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gkelly - 28 May 2004 22:29 GMT
I have a control that I wrote that acts as a layout manager so when I drop
controls onto it in the designer it will automatically move and resize them
based on certain properties.  This works fine.  However, there are times
that after I move some of the child controls around  manually, I'd like the
parent to re-lay them out according to its rules.  To do this I added a
designer, not to do anything graphical, but rather just to add a DesignVerb
to the properties window that labeled "Layout".

This works, except for one bad side effect.  The code with enabled is:

[Designer(typeof(MyDesigner))]
public class Layout :
 ScrollableControl, IContainerControl

and when disabled is:
//  [Designer(typeof(MyDesigner))]
public class Layout :
 ScrollableControl, IContainerControl

when it is enabled and I go to the form where I have placed a "Layout" on
the form, I can not longer see the grid "inside" of the control and I can't
select controls that are in it nor can I drop any new ones on it.

When I disabled the MyDesigner, then all works well, except I don't have the
DesignVerb available.

Does anyone know how to create a designer for a control such that you can
still add controls to it in the designer?

gkelly
gkelly - 28 May 2004 22:51 GMT
found the problem

solution:

when declaring the designer class I changed it from

internal class MyDesigner : System.Windows.Forms.Design.ControlDesigner {
to
internal class MyDesigner :
System.Windows.Forms.Design.ParentControlDesigner {

> I have a control that I wrote that acts as a layout manager so when I drop
> controls onto it in the designer it will automatically move and resize them
[quoted text clipped - 26 lines]
>
> gkelly
Eric Cadwell - 28 May 2004 23:13 GMT
Does MyDesigner Inherit from ParentControlDesigner?

HTH;
Eric Cadwell
http://www.origincontrols.com
gkelly - 01 Jun 2004 17:26 GMT
yes.

> Does MyDesigner Inherit from ParentControlDesigner?
>
> HTH;
> Eric Cadwell
> http://www.origincontrols.com
Igor Babic - 04 Jun 2004 11:47 GMT
Igor Babic - 04 Jun 2004 11:54 GMT
You can create your controls from the Panel (Inherits from
System.Windows.Forms.Panel) and then you will get the designer for adding
control in it automatically.

Igor

> Does anyone know how to create a designer for a control such that you can
> still add controls to it in the designer?

> I have a control that I wrote that acts as a layout manager so when I drop
> controls onto it in the designer it will automatically move and resize them
[quoted text clipped - 26 lines]
>
> gkelly

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.