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