The Panel control is a container of other controls. The Panel control is displayed by default without any borders at run time.
How to use Panel control
Drag and drop Panel control from toolbox on the window Form.
Collection of control can be placed in side Panel.
Transparent Panel
First set BackColor of Panel suppose you set green then set Form's TransparencyKey property to the same color as Panel's background color –red in this case.
Private Sub Form25_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'change back color of Panel
Panel1.BackColor = Color.Red
'set Form's TransparencyKey to the same color as Panel's back color
Me.TransparencyKey = Color.Red
'Me keyword provide a way to refer to the current instance of class, that is,the instance in which code is running
End Sub
Now when you run the application then panel will be transparent.
Panel properties
BackColor: Panel BackColor can be changed through BackColor property.
Private Sub Form25_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'change panel backcolor
Panel1.BackColor = Color.BlanchedAlmond
End Sub
BorderStyle: Get or set BorderStyle of Panel.
Private Sub Form25_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'set BorderStyle of panel
Panel1.BorderStyle = BorderStyle.FixedSingle
End Sub
Visible: You can hide all control inside panel through visible property of Panel. If you want to hide then set visible to false.
Private Sub Form25_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'hide panel
Panel1.Visible = False
End Sub
Now when applications run then Panel will not be show.
Leave Comment