HOW TO:水平分隔視窗
下列程式碼範例會製作水平分割 SplitContainer 控制項的分隔器 (Splitter)。
注意事項 |
---|
SplitContainer 控制項的 Orientation 屬性會決定分隔器的方向,而不是控制項本身的方向。 |
水平分隔視窗
在程序中,將 SplitContainer 控制項的 Orientation 屬性設定為 Horizontal。
Sub ShowSplitContainer() Dim splitContainer1 as new SplitContainer() splitContainer1.BorderStyle = BorderStyle.Fixed3D splitContainer1.Location = New System.Drawing.Point(74, 20) splitContainer1.Name = "DemoSplitContainer" splitContainer1.Size = New System.Drawing.Size(212, 435) splitContainer1.TabIndex = 0 splitContainer1.Orientation = Orientation.Horizontal Controls.Add(splitContainer1) End Sub
public void showSplitContainer() { SplitContainer splitContainer1 = new SplitContainer (); splitContainer1.BorderStyle = BorderStyle.Fixed3D; splitContainer1.Location = new System.Drawing.Point (74, 20); splitContainer1.Name = "DemoSplitContainer"; splitContainer1.Size = new System.Drawing.Size (212, 435); splitContainer1.TabIndex = 0; splitContainer1.Orientation = Orientation.Horizontal; this.Controls.Add (splitContainer1); }