예제 #1
0
        private void splitContainer_MouseMove(object sender, MouseEventArgs e)
        {
            SplitContainer splitter = (SplitContainer)sender;

            if (splitter.IsSplitterFixed)
            {
                if (e.Button.Equals(MouseButtons.Left))
                {
                    if (splitter.Orientation.Equals(Orientation.Vertical))
                    {
                        if (e.X > 0 && e.X < splitter.Width)
                        {
                            splitter.SplitterDistance = e.X;
                            splitter.Refresh();
                        }
                    }
                    else
                    {
                        if (e.Y > 0 && e.Y < splitter.Height)
                        {
                            splitter.SplitterDistance = e.Y;
                            splitter.Refresh();
                        }
                    }
                }
                else
                {
                    splitter.IsSplitterFixed = false;
                }
            }
        }
예제 #2
0
 private void tsMnuItemNormal_Click(object sender, EventArgs e)
 {
     if (pnlCenter.Visible)
     {
         pnlCenter.Visible = false;
         if (this.Parent is SplitterPanel)
         {
             SplitContainer container = this.Parent.Parent as SplitContainer;
             container.SplitterDistance = 30;
             container.Refresh();
         }
         else
         {
             this.Parent.Height = 30;
         }
         tsMnuItemNormal.Checked = true;
         tsMnuItemHigh.Checked   = false;
     }
 }
        /// <summary>
        /// Assing the position to the control if it is a SplitContainer.
        /// Search in the Contained Controls to process all the existing ones in the form.
        /// </summary>
        /// <param name="control"></param>
        /// <param name="properties"></param>
        private void SetSpliterInfo(Control control, StringDictionary properties)
        {
            SplitContainer split = control as SplitContainer;

            if (split != null)
            {
                string value = properties[split.Name];
                if (value != null)
                {
                    split.SuspendLayout();
                    split.SplitterDistance = int.Parse(value);
                    split.Refresh();
                    split.ResumeLayout(true);
                }
            }

            foreach (Control subControl in control.Controls)
            {
                SetSpliterInfo(subControl, properties);
            }
        }