Setting the Windows Form Icon

  • Thread starter Thread starter Stu
  • Start date Start date
S

Stu

Hi,

I'm looking for some help before I've totally pulled my hair out!

I have a windows form project (written in C#) and I would like to set the
form icon to my own choice. I have tried all of the following with no
luck...

a) Changed the form's icon property to my own.
b) Set the Build Action to Embedded Resource.
c) Set the Application Icon in Project > Settings to my icon.
d) Renamed my icon to App.ico and deleted the original one.

Whenever I run my App all I get is a grey square.

All suggestions welcome.

Many thanks,

Stuart
 
Yes, Icon usage in WinForms is confusing, to say the least, and the
documentation is not real explicit. In most cases, the "right thing" to do
is:
1. Edit App.Ico to make it look like you want.
2. In the property pane for your form, set the Icon property to your
project's App.Ico file.
3. Rebuild solution.

Most of the problems I've had with this come about because my App.Ico didn't
have the correct size/bit-depth version in it for whatever context WinForms
wanted (e.g. the form's title bar icon, the system tray icon, the taskbar
icon, or the desktop shortcut icon), or I had screwed up the design of the
icon with respect to transparency issues.

There's a pretty good article about how WinForms uses .ico files, what needs
to be in your .ico file, and how to manage .ico files at
http://www.hhhh.org/cloister/csharp/icons/ that you might find helpful. I
know it helped me out...
 
Chaps,

Thanks for taking time out and replying. I have looked at the article and I
have become enlightened!
My problems have now vanished.

Thanks guys!

Stu
 
Back
Top