如何:水平拆分窗口

下面的代码示例生成了一个水平拆分 SplitContainer 控件的拆分器。

备注

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);
    
    }
    

请参见

参考

SplitContainer

其他资源

SplitContainer 控件(Windows 窗体)