Width Property (Panel Object) Example

This example creates three Panel objects and sets their Width property to different values. When you click on the form, the Width property of the first Panel is reset. To try the example, place a StatusBar control on a form, and paste the code into the Declarations section. Run the example and click on each panel to see its width.

Private Sub Form_Load()
   Dim X As Panel
   Dim I as Integer
   For I = 1 to 2   ' Add 2 panels.
      Set X = StatusBar1.Panels.Add()
   Next I
   With StatusBar1.Panels
      .Item(1).Text = "Path = " & App.Path
      .Item(1).AutoSize = sbrContents   ' Contents
      .Item(1).Width = 2000   ' A long panel
      .Item(2).Text = "Record Field"
      .Item(2).AutoSize = sbrSpring   ' Spring
      .Item(2).Width = 1000   ' A medium panel
      .Item(3).Style = sbrTime   ' Time
      .Item(3).AutoSize = sbrSpring   ' Spring
      .Item(3).Width = 500   ' A medium panel
   End With
End Sub

Private Sub Form_Click()
   ' Change Width.
   StatusBar1.Panels(1). Width = 800
End Sub