Visually Editing Panels and DesignerAttributes

A

AndrewDucker

I've just started working with some people that have an odd setup and
I'm wondering if someone can point out a better way of doing things (or
what I'm doing wrong).

They have a base form class, derived from the standard Form, but with
the ability to show a list of panels in order.

Each of these panels is a subclass of a subclass of Panel. The initial
subclass is tweaked to work with the special form and then each
subclass of that is what will actually be displayed on the special
form.

This all works fine, but because there is no visual editor for panels
in VS.NET they've taken to going into the panel code, changing the
superclass from PanelSpecial to Form, editing the form visually and
then changing the superclass back to PanelSpecial again.

I'm fairly new to C#, but some digging around made me think that
putting this attribute into the PanelSpecial class would mean that the
subclasses could be edited as if they were forms (without all that
tedious setting/resetting of the superclass).

[Designer("System.Windows.Forms.Design.DocumentDesigner,
System.Windows.Forms.Design.DLL",
typeof(IRootDesigner)),
DesignerCategory("Form")]

However this doesn't work at all (I get an "unable to find a designer"
error), although by playing around with it I've been able to make it
display the component editing designer but this isn't actually very
useful.

Can anyone suggest either a way to make the visual editing of panels
work ok, or an alternative architecture which would allow GUI editing?

Thanks,

Andy D
 
J

James

They should create a subclass of UserControl, place a Panel on it, and then
add their special code from there. You can graphically design UserControls.

JIM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top