Alignment Property (HeaderItem, Panel Object) Example

This example adds two Panel objects to a StatusBar control and aligns the text in each panel using one of the three available styles. To try the example, place a StatusBar control on a form and paste the code into the Declarations section of the form. Run the example.

Private Sub Form_Load()
  ' Declare variables.
  Dim pnlX As Panel
  Dim I As Integer
  
  For I = 1 To 2  ' Add two panels.
  StatusBar1.Panels.Add
  Next I
  
  For I = 1 To 3  ' Add pictures to each Panel.
  Set pnlX = StatusBar1.Panels(I)
  Set pnlX.Picture = LoadPicture("Graphics\icons\comm\net12.ico")
      ' Set AutoSize and MinWidth so that panels
      ' are always in view.
  pnlX.AutoSize = sbrSpring
  pnlX.MinWidth = 1
  Next I
  
  ' Set styles and alignment.
  With StatusBar1.Panels
  .Item(1).Text = "Left"
  .Item(1).Alignment = sbrLeft ' Left alignment.
  .Item(2).Text = "Center"
  .Item(2).Alignment = sbrCenter ' Centered alignment.
  .Item(3).Text = "Right"
  .Item(3).Alignment = sbrRight ' Right alignment.
  End With
End Sub