By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,011 Online
Bytes IT Community
Submit an Article
Got Smarts?
Share your bits of IT knowledge by writing an article on Bytes.

C#: Setting Icons

Plater
Expert 5K+
P: 7,872
C# (and possibly VB.NET) in VS2005 can be a bit tricky.
Here's my little rundown:

Add an icon file to your project (new or exisiting, whichever)
Open the icon file is VS and edit as desired.
(Note: On the left hand side is a small preview of the icon, extra sizes can be added to the SAME icon file there as well as cycling through existing sizes by using the Image menu.)
Set your icons as desired. A 16x16 size will be used withen the taskbar entry and window title bar. A 32x32 size will be used as the main program icon (most likely)

Set the program icon:
Under the project name in the solution explorer will be a grayed folder called "Properties" open it. Under the Application tab is a section for the Icon/Resources. Select your desired icon.

Set the taskbar entry icon and window title bar icon:
Open up the desired form in designer mode. Select the actual form itself. In the properties window scroll to the icon section. Select your icon. (Optionally you can find the "ShowIcon" and "ShowInTaskbar" options and change them as desired)

This took awhile for me to figure out, hopefully it helps the rest of you.
May 17 '07 #1
Share this Article
Share on Google+
1 Comment


Plater
Expert 5K+
P: 7,872
I have made a test icon, it contains a 16x16, a 32x32, a 48x48, a 64x64 and a 96x96 image, each labeled with the number of their dimension.
You can use it to view which icon sizes are used by which control/components
Attached Files
File Type: zip DemoIcon.zip (540 Bytes, 3469 views)
Feb 8 '08 #2