changing icon in statusbar

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.
 
H

Herfried K. Wagner [MVP]

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]>
 
G

Guest

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
 
H

Herfried K. Wagner [MVP]

Kishan Hathiwala said:
the link you provided is not working

Maybe you'll have to remove the '<URL:'...'>' markup in order to make it
work...
 
G

Guest

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
 
K

Kishan Hathiwala

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top