StatusBars Control in VB.NET

A status bar control is used to display the status of your applications functionality. You can add as many as panels to a status bar as you want and use these panels to display different type of information.
  • 6392
Download Files:
 

Description.

A status bar control is used to display the status of your applications functionality. You can add as many as panels to a status bar as you want and use these panels to display different type of information.
SttsBarmcb.jpg

StatusBar class is used to create status bars and StatusBarPanel class is used to panels.

Me.statusBar1 = New System.Windows.Forms.StatusBar()
Dim pnl1 As New StatusBarPanel()
Dim pnl2 As New StatusBarPanel()

You add panels to the status bar by calling StatusBar.Panels.AddRange.

statusBar1.Panels.AddRange( new StatusBarPanel[] {pnl1, pnl2});

Setting Image In the Panel

You use Icon class to insert an image in the panel control. You set Icon property of a panel as Icon class.

Dim icon As New Icon("c:\mouse.ico")
pnl1.Icon = icon

Source Code:

Me.statusBar1 = New System.Windows.Forms.StatusBar()
statusBar1.ShowPanels =
True
Me
.statusBar1.Location = New System.Drawing.Point(0, 253)
Me.statusBar1.Name = "statusBar1"
Me.statusBar1.Size = New System.Drawing.Size(292, 20)
Me.statusBar1.TabIndex = 0
Me.statusBar1.Text = "statusBar1"
Dim pnl1 As New StatusBarPanel()
Dim pnl2 As New StatusBarPanel()
pnl1.Text = "Panel 1"
pnl1.Width = 32
pnl1.AutoSize = StatusBarPanelAutoSize.Spring
Dim icon As New Icon("c:\mouse.ico")
pnl1.Icon = icon
pnl2.Text = DateTime.Now.ToString()
statusBar1.Panels.AddRange(New StatusBarPanel() {pnl1, pnl2})

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.