JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Displaying Icons in Status Bar Panels

It's easy to add icons to panels in a status bar; at design time, just select the status bar, click the Panels property in the Properties window to open the StatusBar Panel Collection Editor. Then select the panel, click the Icon property in the StatusBarPanel Collection Editor, and browse to the icon file (extension .ico) you want to use.

And you can do the same thing at run time; all you need to do is to assign an Icon object to a status bar panel's Icon property and you can create an Icon object by passing a filename to the Icon class's constructor:

Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    StatusbarPanel1.Icon = New Icon("c:\vbnet\ch10\statusbars\waste.ico")
End Sub

If you prefer, you can access the status bar panel from the status bar's Panels collection:

Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    StatusBar1.Panels(0).Icon = New _
        Icon("c:\vbnet\ch10\statusbars\waste.ico")
End Sub

You can see an icon in the third panel of the status bar in Figure 10.22 in the StatusBars example on the CD-ROM.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor