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. how to use an icon in multiple places

how to use an icon in multiple places

Scheduled Pinned Locked Moved C#
helpquestiontutorial
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.
  • V Offline
    V Offline
    visiontec
    wrote on last edited by
    #1

    Hi there I have an icon that i use as: my application's icon my notifyicon's icon and my main form's icon its a 22kb icon. now everything works fine but the size of my app increases three times! (66kb) when it should only have increased 22kb how can i fix this problem or is this something normal? VisionTec

    H 1 Reply Last reply
    0
    • V visiontec

      Hi there I have an icon that i use as: my application's icon my notifyicon's icon and my main form's icon its a 22kb icon. now everything works fine but the size of my app increases three times! (66kb) when it should only have increased 22kb how can i fix this problem or is this something normal? VisionTec

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Use only one instance of it, say from a static class:

      public sealed class AppInfo
      {
      private AppInfo() {} // Prevent instantiation
      private static Icon AppIcon; // Private field
      static AppInfo() // Static constructor
      {
      AppIcon = new Icon(typeof(AppInfo), "App.ico");
      }
      }

      This is a basic example, but should give you the idea. You won't be able to use the same icon for the application (the icon that is at the first index in the PE/COFF executables .rsrc section), though. That's stored different than the "App.ico" (example) for which you should change the build action to "Embedded Resource".

      Microsoft MVP, Visual C# My Articles

      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