TrackBar.Orientation Property

Gets or sets a value indicating the horizontal or vertical orientation of the track bar.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

[LocalizableAttribute(true)] 
public Orientation Orientation { get; set; }
/** @property */
public Orientation get_Orientation ()

/** @property */
public void set_Orientation (Orientation value)

public function get Orientation () : Orientation

public function set Orientation (value : Orientation)

Property Value

One of the Orientation values.

Exception typeCondition

InvalidEnumArgumentException

The assigned value is not one of the Orientation values.

When the Orientation property is set to Orientation.Horizontal, the scroll box moves from left to right as the Value increases. When the Orientation property is set to Orientation.Vertical, the scroll box moves from bottom to top as the Value increases.

The following example demonstrates how to set some of the TrackBar properties.

trackBar2.Orientation = Orientation.Vertical;
trackBar3.Orientation = Orientation.Vertical;
trackBar1.Maximum = trackBar2.Maximum = trackBar3.Maximum = 255;
trackBar1.Width = 400;
trackBar2.Height = trackBar3.Height = trackBar1.Width;
trackBar1.LargeChange = trackBar2.LargeChange = trackBar3.LargeChange = 16;

trackBar2.set_Orientation(Orientation.Vertical);
trackBar3.set_Orientation(Orientation.Vertical);
trackBar1.set_Maximum(255);
trackBar2.set_Maximum(255);
trackBar3.set_Maximum(255);
trackBar1.set_Width(400);
trackBar2.set_Height(trackBar1.get_Width());
trackBar3.set_Height(trackBar1.get_Width());
trackBar1.set_LargeChange(16);
trackBar2.set_LargeChange(16);
trackBar3.set_LargeChange(16);

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Show: