Answered SplitContainer

  • Saturday, February 25, 2012 7:50 AM
     
     

    Hi 

    I am using splitcontainer control but on a button click I want to make Panel1 hidden. What property needs to be set for this ?

All Replies

  • Monday, February 27, 2012 9:46 AM
     
     

    Check this one and may be it will help full one

    http://social.msdn.microsoft.com/forums/en-us/winforms/thread/FB9F16EE-1BC8-4C06-A397-CCB104E5E25C


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"

  • Tuesday, February 28, 2012 3:55 AM
    Moderator
     
     Answered Has Code
    Hi sqldeveloper2008,

    Is this what you want ?
    splitContainer1.Panel1.Hide();

    If no, please elaborate more clearly about how the HIDE act like.

    Regards,

    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us

  • Thursday, March 01, 2012 8:47 AM
     
     
    Actually I have one splitContainer which contains 2 panels, one panel contains datagrid and another one contains treeview. now I have added one button "Show datagrid only", when user click on this button I want to hide panel2 which contains treeview and would like to show Panel1 only with Datagrid (Dock Fill).
  • Thursday, March 01, 2012 9:09 AM
    Moderator
     
     Answered
    Hi sqldeveloper2008,

    You can do that by setting SpliteContainer1.SplitterDistance=0,  SplitContainer.SplitterDistance is going to get or set the location of the splitter, in pixels, from the left or top edge of the SplitContainer

    Another way is to use TabControl control to show just one page at one time.

    Regards,

    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us

  • Monday, March 05, 2012 5:13 PM
     
     

    Hi,

    I have a splitcontainer with 2 panels, when user click on "Show Upper Panel" button, I want to show Upper Panel only and When user click on "Show Lower Panel", it should show lower panel only.

  • Thursday, March 08, 2012 5:45 AM
    Moderator
     
      Has Code
    I have suggested in two replies, none of them you have reacted. Now, according to your description and image, you can set the panel.Hide()  or change the SpliteContainer1.SplitterDistance in the buttons' Click event respectively.
    eg. to hide the upper panel:                  splitContainer1.SplitterDistance = 0;
         to hide the lower panel:                splitContainer1.SplitterDistance = splitContainer1.Height;

    If it's not what you want, please let me know.

    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us