-
August 3rd, 2006, 11:41 AM
#1
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
-
August 3rd, 2006, 11:58 AM
#2
Re: Reuse Panel in Another Form
Rather than subclass Panel, it is better to subclass UserControl.
Useful? Then click on (Rate This Post) at the top of this post.
-
August 3rd, 2006, 12:05 PM
#3
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.
-
August 4th, 2006, 03:07 AM
#4
Re: Reuse Panel in Another Form
Originally Posted by Norfy
Rather than subclass Panel, it is better to subclass UserControl.
That is the answer! Thanks very much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|