SplitContainer.Orientation 属性

定义

获取或设置一个值,该值指示 SplitContainer 面板处于水平方向还是垂直方向。

public:
 property System::Windows::Forms::Orientation Orientation { System::Windows::Forms::Orientation get(); void set(System::Windows::Forms::Orientation value); };
public System.Windows.Forms.Orientation Orientation { get; set; }
member this.Orientation : System.Windows.Forms.Orientation with get, set
Public Property Orientation As Orientation

属性值

Orientation

Orientation 值之一。 默认值为 Vertical

例外

分配的值不是 Orientation 值之一。

示例

下面的代码示例显示了一个水平拆分器,其顶部和底部面板包含 ListView 控件。 还显示了水平拆分器的其他基本属性。 此示例是为类提供的大型示例的 SplitContainer 一部分。

// 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 = System::Drawing::Point( 0, 0 );
splitContainer2->Name = "splitContainer2";

// Create the horizontal splitter.
splitContainer2->Orientation = System::Windows::Forms::Orientation::Horizontal;
splitContainer2->Size = 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";
// 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";
' 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"

注解

Orientation使用属性可更改SplitContainer从垂直到水平或从水平更改为垂直。

适用于

另请参阅