예제 #1
0
 public void Clear()
 {
     if (splitContainer1.InvokeRequired)
     {
         splitContainer1.Invoke(new MethodInvoker(Clear));
         return;
     }
     if (panel.Controls.Count == 0)
     {
         panel.RowCount = 1;
     }
     Layout();
 }
예제 #2
0
        /// <summary>
        /// Thread safe version to show or hide a split container panel.
        /// </summary>
        /// <param name="splitContainer"> The <see cref="SplitContainer"/> control. </param>
        /// <param name="show"> True, if the panel should be visible, otherwise false. </param>
        /// <param name="panel1">True if panel1 of the splitcontainer should be modified, for panel2 set this to false.</param>
        public static void ShowHideSplitContainerPanel(SplitContainer splitContainer, bool show, bool panel1)
        {
            if (splitContainer.InvokeRequired)
            {
                splitContainer.Invoke(new ShowHidePanelInvoker(ShowHideSplitContainerPanel), splitContainer, show, panel1);
            }

            if (panel1)
            {
                splitContainer.Panel1Collapsed = !show;
            }
            else
            {
                splitContainer.Panel2Collapsed = !show;
            }
        }