Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. a resx file and ico question.

a resx file and ico question.

Scheduled Pinned Locked Moved C#
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sameerhanda
    wrote on last edited by
    #1

    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

    R 1 Reply Last reply
    0
    • S sameerhanda

      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

      R Offline
      R Offline
      Robert Rohde
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups