a resx file and ico question.
-
Hello everyone, I have inherited a piece of code that is using a resx file to embed icon in it. These icons are then used in a class. The icon node looks something like this iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 .... Well, I have never done anything like this before, but i need to add a "+" icon to my app. How do I go about getting the "binary value" for my icon. Any help would be tremendously appreciated. Thanks Sameer
-
Hello everyone, I have inherited a piece of code that is using a resx file to embed icon in it. These icons are then used in a class. The icon node looks something like this iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 .... Well, I have never done anything like this before, but i need to add a "+" icon to my app. How do I go about getting the "binary value" for my icon. Any help would be tremendously appreciated. Thanks Sameer
There are several ways to get resources into your project. One way is the following: 1. Add the icon to your project (rightclick -> Add Existing file) 2. Change its 'Build Action' property to 'Embedded Resource' 3. In your code write the following:
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
Stream inputStream = assembly.GetManifestResourceStream("YourNamespace.YourFile.ico");
Icon yourIcon = new Icon(inputStream);The code assumes that the icon is in the same assembly as the code which accesses it. 'YourNamespace' is the one you can set in the properties of each project.