MinWidth Property Example

This example uses the default panel of a StatusBar control to display the current date. The MinWidth property is set so that when you click on the panel, the date is cleared but the panel remains the same size. To use the example, place a StatusBar control on a form, and paste the code into the Declarations section. Run the example and click on the Panel object to clear the date.

Private Sub Form_Load()
  StatusBar1.Panels(1).AutoSize = sbrContents
  StatusBar1.Panels(1).Text = "Today's Date is: " & Str(Now)
  ' Set minimum width to the current size of panel
  StatusBar1.Panels(1).MinWidth = StatusBar1.Panels(1).Width
End Sub

Private Sub StatusBar1_PanelClick(ByVal Panel As ComctlLib.Panel)
  ' Clear todayÆs date but keep size at minimum width.
  Panel.Text = "TodayÆs Date is: "
End Sub