Splitter Control in C#

This article demonstrates how to use Windows Forms Splitter control using C#.


Note: SplitContainer Control has replaced Splitter control in .NET 2.0 (Visual Studio 2005) or later versions.


Using splitter control in VS.NET Beta 1 IDE is a pain. Its seems there is a bug in Splitter Control. Any way, In this article, I will explain how to write application with splitter control. Just follow few simple steps -

  • Add a List box or any control.
  • Set its Dock property to Left.
  • Add a splitter.
  • Right click on the list box and select Bring to Front.
  • Add a Panel to the Right side of the form.
  • Right Click on it and select Send to Back.

Splitter.jpg

Here is the code added from the splitter control -
this.splitter1 = new System.WinForms.Splitter ();
splitter1.BorderStyle = System.WinForms.BorderStyle.FixedSingle;
splitter1.BackColor = System.Drawing.Color.Red;
splitter1.Location =
new System.Drawing.Point (120, 0);
splitter1.Size =
new System.Drawing.Size (8, 237);
splitter1.TabIndex = 1;
splitter1.TabStop =
false;

See attached project for more details.