Two Panels with Splitter : Splitter « GUI Windows Form « C# / C Sharp






Two Panels with Splitter

 

using System;
using System.Drawing;
using System.Windows.Forms;
   
class TwoPanelsWithSplitter: Form
{
     public static void Main()
     {
          Application.Run(new TwoPanelsWithSplitter());
     }
     public TwoPanelsWithSplitter()
     {
          Panel panel1     = new Panel();
          panel1.Parent    = this;
          panel1.Dock      = DockStyle.Fill;
          panel1.BackColor = Color.Lime;
          panel1.Resize   += new EventHandler(PanelOnResize);
          panel1.Paint    += new PaintEventHandler(PanelOnPaint);
   
          Splitter split   = new Splitter();
          split.Parent     = this;
          split.Dock       = DockStyle.Right;
   
          Panel panel2     = new Panel();
          panel2.Parent    = this;
          panel2.Dock      = DockStyle.Right;
          panel2.BackColor = Color.Red;
          panel2.Resize   += new EventHandler(PanelOnResize);
          panel2.Paint    += new PaintEventHandler(PanelOnPaint);
     }
     void PanelOnResize(object obj, EventArgs ea)
     {
          ((Panel) obj).Invalidate();
     }
     void PanelOnPaint(object obj, PaintEventArgs pea)
     {
          Panel    panel = (Panel) obj;
          Graphics grfx  = pea.Graphics;
   
          grfx.DrawEllipse(Pens.Black, 0, 0, 
                           panel.Width - 1, panel.Height - 1);
     }
}

 








Related examples in the same category

1.HTML Split WindowHTML Split Window
2.Split Two Proportional
3.Split Three Frames
4.Split Three Across
5.One Panel with Splitter