changing icon in statusbar

  • Thread starter Thread starter Kishan Hathiwala
  • Start date Start date
K

Kishan Hathiwala

Hi

i have kept a statusbar in the form with panels = true. and total there 3
panels. whenever i click on the 3rd panel a menu appears showing online and
offline and either is enable at a time. once i clic on online its icon
changes to connecticon (assume its there) and whenever i click on offline,
its icon changes to disconnection (assume this is also there).

now the problem is i have kept one icon for connection (ie when its online -
by default using windows property) now i want to change its icon in runtime.
can i see how it can be changed?

and in the 2nd panel
thanks

K.
 
Kishan Hathiwala said:
i have kept a statusbar in the form with panels = true. and total there 3
panels. whenever i click on the 3rd panel a menu appears showing online
and
offline and either is enable at a time. once i clic on online its icon
changes to connecticon (assume its there) and whenever i click on offline,
its icon changes to disconnection (assume this is also there).

now the problem is i have kept one icon for connection (ie when its
online -
by default using windows property) now i want to change its icon in
runtime.

<URL:http://www.google.de/[email protected]>
 
Hi Kishan

The key is in the event object on the Status Bar Panel click event handler.

This code swaps the form's icon and the status bar icon when you click on it:

HTH

Nigel

Private Sub StatusBar1_PanelClick(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.StatusBarPanelClickEventArgs) Handles
StatusBar1.PanelClick
Dim i As Icon = e.StatusBarPanel.Icon
e.StatusBarPanel.Icon = Me.Icon
Me.Icon = i
End Sub
 
Kishan,
the thing is the icon is not of form's icon. its outsided icon

I realise that...I thought you might be able to look at the constructor for
the Icon class to do the rest. For example, if you want to load from an Icon
file C:\test.ico, then you would create your icon as:

Dim i1 As New Icon("C:\test.ico")

There are other options as well, such as from resource files etc...

HTH

Nigel Armstrong
 
can you just provide me sample code, if possible

Nigel Armstrong said:
Kishan,


I realise that...I thought you might be able to look at the constructor for
the Icon class to do the rest. For example, if you want to load from an Icon
file C:\test.ico, then you would create your icon as:

Dim i1 As New Icon("C:\test.ico")

There are other options as well, such as from resource files etc...

HTH

Nigel Armstrong
 
Back
Top