resource icons

  • Thread starter Stephan Steiner
  • Start date
S

Stephan Steiner

Hi

I've just created my first application that registers an icon in the
taskbar. In the process I noted that my icon doesn't show up as external
file in the project, it seems to be registered as a resource somehow. Now
I'm wondering if I could add additional icons so that I don't have to
deliver them with the executable, but since I don't know how the first icon
belonging to the NotifyIcon has been added, there's no way I can duplicate
that process without adding another NotifyIcon.

Any ideas?

Regards
Stephan
 
H

Herfried K. Wagner [MVP]

* "Stephan Steiner said:
I've just created my first application that registers an icon in the
taskbar. In the process I noted that my icon doesn't show up as external
file in the project, it seems to be registered as a resource somehow. Now
I'm wondering if I could add additional icons so that I don't have to
deliver them with the executable, but since I don't know how the first icon
belonging to the NotifyIcon has been added, there's no way I can duplicate
that process without adding another NotifyIcon.

Add the icon file to your project and set its 'Build Action' property to
'Embedded Resource'. You can use the code below to load the icon at
runtime:

\\\
foo.Icon = _
New Icon( _
[Assembly].GetExecutingAssembly().GetManifestResourceStream( _
"WindowsApplication1.Ball.ico" _
) _
)
///

'WindowsApplication1' is the root namespace of the application, "Ball.ico"
is the icon's filename.
 

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