Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C# (http://www.programmingforums.org/forum16.html)
-   -   (C#) Too many forms in my program, want to consolidate. (http://www.programmingforums.org/showthread.php?t=14892)

Druid Jan 8th, 2008 9:10 AM

(C#) Too many forms in my program, want to consolidate.
 
I have written a C# program that uses 20+ windows forms. Instead of opening a new window every time a user selects a menu item or clicks a button, I want it to open in the same window. Like having a section of the main window to hold the content of the form, instead of creating a separate form.

I was looking into panels and tabs, but I want the layout to be as transparent as possible to the user. Can anyone suggest a component to use or any other ideas?

Sane Jan 8th, 2008 9:55 AM

Re: (C#) Too many forms in my program, want to consolidate.
 
The conventional thing to do for that is notepad tabs, as you've pointed out.

If you don't think that would look very nice, then you could group together each layout on a different panel. And then, at will, toggle which panel in memory is visible in the current form. At least this is what's done in other GUI toolkits I've used. It should be applicable to C#, or at least close.

lectricpharaoh Jan 8th, 2008 7:04 PM

Re: (C#) Too many forms in my program, want to consolidate.
 
Quote:

Originally Posted by Druid
I was looking into panels and tabs, but I want the layout to be as transparent as possible to the user. Can anyone suggest a component to use or any other ideas?

I can understand your concern with tabs, if you want it to be transparent to the user. However, why the concern with panels? Just create multiple panels of the same size in the same location, and only have one visible at a time.

The only gotcha with this approach is you will need to name your controls in such a manner as to avoid name conflicts. For example, btnNext might become btnPanel1Next.

Dameon Jan 8th, 2008 8:59 PM

Re: (C#) Too many forms in my program, want to consolidate.
 
I have seen several interfaces with multiple panels selectable from push buttons and tree views. Works great. Think of PuTTY and the Firefox options page.

lectric is right about the namespace issue. Also consider the difficulty in dealing with such a layout in the VS designer. You have to change the z-order of the panels to get to the one you want to edit. What you can also do...create a separate class for each panel (user control, inherited control, can't remember). Add a new instance of the desired panel and set it to Dock Full when a section/button is selected.


All times are GMT -5. The time now is 3:58 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC