none
Overlapping Panels

    Question

  • Guys, I've got a Windows From that I'm building that I would like to have dynamic content on.  In other words,  I want to reuse a certain space on my form for many different controls depending on the output from say, a combo box.  I would have to assume this is a fairly common practice, but I've found no control that lets me lay this out in the designer mode with ease.

    I instead have created multiple "panel" controls for each view, or mode.  Then too edit each of these, I have to select the right one and bring it to the front to see and edit it.  When the app is running, I do something similar and do a xxxx.BringToFront(); on the panel I want to view, or I suppose I could just make .Visible the only one I want to see.

    Is there an easier way of doing this?  I know the "TabControl" Control is close, but I really want the combobox to control what is displayed, not tabs.

    Any help?
    Wednesday, April 15, 2009 3:29 PM

Answers

  • I ran into the same issue a few months ago on one of my projects. I wanted to use the TabControl just because the design-time editing was easier. (I could click on the tab to update the desired panel.)

    But there is no way to hide the tab part and just display the contents of the tab panel. So we wrote some code to pull the panels from the Tab control at runtime. Not sure it was worth the effort.

    Another option is to create each panel's contents as a user control and hide/show the user controls instead of the panels. Again, I'm not sure this gets you much other than an easier design-time experience for editing the different user controls.

    The other option, of course, is to move to WPF, which provides this type of functionality. But if your goal is actually to get this done some time soon ... this is not a good option. :-)
    • Marked as answer by njbraun Wednesday, April 15, 2009 4:10 PM
    • Unmarked as answer by njbraun Wednesday, April 15, 2009 4:10 PM
    • Proposed as answer by Guo Surfer Sunday, April 19, 2009 7:27 AM
    • Marked as answer by Guo Surfer Tuesday, April 21, 2009 8:03 AM
    Wednesday, April 15, 2009 3:43 PM

All replies

  • I ran into the same issue a few months ago on one of my projects. I wanted to use the TabControl just because the design-time editing was easier. (I could click on the tab to update the desired panel.)

    But there is no way to hide the tab part and just display the contents of the tab panel. So we wrote some code to pull the panels from the Tab control at runtime. Not sure it was worth the effort.

    Another option is to create each panel's contents as a user control and hide/show the user controls instead of the panels. Again, I'm not sure this gets you much other than an easier design-time experience for editing the different user controls.

    The other option, of course, is to move to WPF, which provides this type of functionality. But if your goal is actually to get this done some time soon ... this is not a good option. :-)
    • Marked as answer by njbraun Wednesday, April 15, 2009 4:10 PM
    • Unmarked as answer by njbraun Wednesday, April 15, 2009 4:10 PM
    • Proposed as answer by Guo Surfer Sunday, April 19, 2009 7:27 AM
    • Marked as answer by Guo Surfer Tuesday, April 21, 2009 8:03 AM
    Wednesday, April 15, 2009 3:43 PM
  • DeborahK, there is a way to hide the tabs on a TabControl.  "NoBugs, that guy's wise."

    WizardPageControl

    You know how you run through a setup, which offeres a series of screeens one after the other.
    Mark the best replies as answers. "Fooling computers since 1971."
    Wednesday, April 15, 2009 5:39 PM
    Moderator
  • Yea, OK. Let me rephase.

    There is no way with the standard control properties to hide the tab part of the Tab control. :-)


    Wednesday, April 15, 2009 5:53 PM
  • Hi njbraun,

    Have you resolved your problem?
    Please follow up with necessary information if you still have problem.  If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.
    Thank you!

    Best regards,
    Guo
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Sunday, April 19, 2009 7:48 AM