This documentation is archived and is not being maintained.

SplitContainer.Orientation Property

Gets or sets a value indicating the horizontal or vertical orientation of the SplitContainer panels.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public Orientation Orientation { get; set; }

Property Value

Type: System.Windows.Forms.Orientation
One of the Orientation values. The default is Vertical.

ExceptionCondition
InvalidEnumArgumentException

The assigned value is not one of the Orientation values.

Use the Orientation property to change the SplitContainer from vertical to horizontal or from horizontal to vertical.

The following code example shows a horizontal splitter whose top and bottom panels contain ListView controls. Other basic properties of a horizontal splitter are also shown. This example is part of a larger example provided for the SplitContainer class.

// Basic SplitContainer properties. 
// This is a horizontal splitter whose top and bottom panels are ListView controls. The top panel is fixed.
splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
// The top panel remains the same size when the form is resized.
splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
splitContainer2.Location = new System.Drawing.Point(0, 0);
splitContainer2.Name = "splitContainer2";
// Create the horizontal splitter.
splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
splitContainer2.Size = new System.Drawing.Size(207, 273);
splitContainer2.SplitterDistance = 125;
splitContainer2.SplitterWidth = 6;
// splitContainer2 is the third control in the tab order.
splitContainer2.TabIndex = 2;
splitContainer2.Text = "splitContainer2";

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: