articles

SplitContainer Control in VB.Net

Pushpendra Singh21905 13-Dec-2010

A SplitContainer has two panels. The first panel is represented by Panel1 and second panel is represented by Panel2. These panels can have their own properties and events.

Drag and drop SplitContainer control from toolbox on the window Form.

SplitContainer Control in VB.Net

You can use both panel as a separate panel.

Properties of SplitContainer control:

·         Orientation - Gets or sets a value indicating the Horizontal or Vertical orientation of the SplitContainer panels.

·         BackgroundImage - Instead of a single color, an image can be displayed as the background. The image only appears in the splitter bar.

Change color of Panel in SplitContainer

 

Private Sub Form26_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim leftpanel As SplitterPanel = SplitContainer1.Panel1
        'change backcolor of Panle1
        leftpanel.BackColor = Color.PowderBlue
        Dim rightpanel As SplitterPanel = SplitContainer1.Panel2
        'change backcolor of Panle2
        rightpanel.BackColor = Color.RoyalBlue
End Sub

Run the project

Backcolor of both panel in splitcontainer is different because both panel works as a separate panel in splitcontainer control.

SplitContainer Control in VB.Net

Collapse panel in splitcontainer

You can collapse one panel out of two panel in SplitContainer.

Private Sub Form26_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Panel1 will be collapse at run time
        SplitContainer1.Panel1Collapsed = True
 End Sub

 

Panel1 will be collapse when apllication run.


SplitContainer Control in VB.Net

Panel1 is collapse.

 


Updated 04-Mar-2020

Leave Comment

Comments

Liked By