Add Method (Panels Collection) Example

This example uses the Add method to add three new Panel objects to a StatusBar control. To use the example, place a StatusBar control on a form and paste the code into the form's Declarations section. Run the example.

Private Sub Form_Load()
Dim pnlX As Panel
  ' Add blank panel as a spacer
  Set pnlX = StatusBar1.Panels.Add()
  pnlX.AutoSize = sbrSpring
  pnlX.MinWidth = 1
  ' Add a panel with a clock icon and time style.
  Set pnlX = StatusBar1.Panels.Add _
  (, , , sbrTime, LoadPicture("Graphics\icons\misc\clock03.ico"))
  ' Add second panel, with bitmap and Date style.
  Set pnlX = StatusBar1.Panels.Add _
  (, , , sbrDate, LoadPicture("Graphics\bitmaps\assorted\calendar.bmp"))
  ' Set Bevel property for last Panel object.
  pnlX.Bevel = sbrInset ' Inset bevel.
  pnlX.Alignment = sbrRight ' Set Alignment property for last object.
  ' Set Text and AutoSize properties for first (default )Panel object.
  StatusBar1.Panels(1).Text = "Add Panel Example"
  StatusBar1.Panels(1).AutoSize = sbrContents
End Sub