PanelClick Event Example

This example adds two Panel objects to a StatusBar control; when each Panel is clicked, the value of the Key and Width properties of the clicked Panel are displayed in the third Panel. To try the example, place a StatusBar control on a form and paste the code into the Declarations section. Run the example.

Private Sub Form_Load()
   Dim I as Integer
   For I = 1 to 2
      StatusBar1.Panels.Add
   Next I

   With StatusBar1.Panels
      .Item(1).Style = sbrDate
      .Item(1).Key = "Date panel"
      .Item(1).AutoSize = sbrContents
      .Item(1).MinWidth = 2000
      .Item(2).Style = sbrTime
      .Item(2).Key = "Time panel"
      .Item(3).AutoSize = sbrContents   ' Content
      .Item(3).Text = "Panel 3"
      .Item(3).Key = "Panel 3"
   End With
End Sub

Private Sub StatusBar1_PanelClick(ByVal Panel As Panel)
   ' Show clicked panel's key and width in Panel 3.
   StatusBar1.Panels("Panel 3").Text = Panel.Key & " Width = " & Panel.Width
End Sub