Visual Studio includes an icon editor that allows you to create custom icons for your applications. I’ve found this experience to be clunky at best, and hair-pullingly frustrating in general. The un-intuitive way you set transparency was one cause of frustration. Another was the icon editor’s tendency to corrupt your icon if you ever hit ctl-z to undo any mistakes. After losing much hair, I’ve finally figured it out. This article shows how to create an icon with transparency in Visual Studio 2013 from an existing image file.
Note: This tutorial shows you how to set a transparency color using a color found in an existing image by setting the background color in the Visual Studio editor. If you want to add transparency manually in the Visual Studio editor, you’ll want to set the special transparency color in VS and draw/fill this color onto your image within Visual Studio. The transparency color icon looks like a little computer monitor and can be found to the right of the foreground/background color icons.
- Open Visual Studio 2013 and select File -> New and create a new Icon file
- Open an existing image file in Paint or other image editor, or create a new one.
- Select a single color in your image to represent transparency. Edit the color to get the RGB values, you’ll need these in Visual Studio in order to set the default background color to match.
- In Visual Studio, insert a new image type with the desired icon size and color depth. Right-click under the existing icon sizes or go to the Image menu and select New Image Type.
- In the colors window, find the background color you’ve decided to use for transparency, or double-click an existing color and modify it to match the RGB values. Then right-click the color tile to set the background color to this transparency color. When you copy/paste your image into Visual Studio, the background color you’ve set will automatically be transparent. Make sure that the foreground color is set to something other than your transparency color, and the background color is set to your transparency color.
- In Paint, select all (CTL + a) and copy (CTL + c) your image.
- In Visual Studio, paste (CTL + v) your copied image into the newly-created Image Type
- Delete unwanted icon Image Types by right-clicking the Image Type and selecting Delete Image Type.
- Save your icon
- Voila! Now you might need to tweak your icon manually to fine-tune the details.