Reuse Panel in Another Form
BACKGROUND:
I have a large application. The menu bar along the top makes a number of different panels visible. So there are many different "screens" (from a user point of view) on the one form.
PROBLEM:
The main Form is becoming a huge class. It is unweildy and doing too much. Also, I need to add more screens, so this will get worse.
ATTEMPTED SOLUTION:
I separated out some of the panels out and made new classes inheriting from Panel (rather than from Form). Then I could add the inherited panel to my main form. This was good for reducing the size of the main form class and separating out functionality. BUT... now I can no longer modify the panels using the visual designer. This is quite awkward when making extensive changes to the design of a panel. (a bit like the old Java days ;-D )
QUESTION:
Is there a way to design a panel on one form, then use it (or an instance of it) on another form?
Many thanks,
StonePiano
Re: Reuse Panel in Another Form
Rather than subclass Panel, it is better to subclass UserControl.
Re: Reuse Panel in Another Form
1 possible solution would be to use a completely seperate form with this panel instead of a panel within the calling form. You could then set the FormBorderStyle to none and just show and hide the form as needed.
Re: Reuse Panel in Another Form
Quote:
Originally Posted by Norfy
Rather than subclass Panel, it is better to subclass UserControl.
That is the answer! Thanks very much.