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 / C++ / MFC
  4. Changing an HICON's colour at runtime

Changing an HICON's colour at runtime

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsdata-structuresquestion
3 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.
  • L Offline
    L Offline
    lastgen
    wrote on last edited by
    #1

    Is there any way to change the colour of a HICON object at runtime without creating a new bitmap? Is there any way to get a pointer/reference to a HICON's colour palette info to modify? Essentially what I need is for the users of a program to be able to change the colours of individual item icons on a tree control at their will. When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!

    M 1 Reply Last reply
    0
    • L lastgen

      Is there any way to change the colour of a HICON object at runtime without creating a new bitmap? Is there any way to get a pointer/reference to a HICON's colour palette info to modify? Essentially what I need is for the users of a program to be able to change the colours of individual item icons on a tree control at their will. When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!

      M Offline
      M Offline
      Monty2
      wrote on last edited by
      #2

      typdef struct
      {
      BITMAPINFOHEADER icHeader; // DIB header
      RGBQUAD icColors[1]; // Color table
      BYTE icXOR[1]; // DIB bits for XOR mask
      BYTE icAND[1]; // DIB bits for AND mask
      } ICONIMAGE, *LPICONIMAGE;

      you can use it to modify the bitmap this[^] page gives more info.


      C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

      L 1 Reply Last reply
      0
      • M Monty2

        typdef struct
        {
        BITMAPINFOHEADER icHeader; // DIB header
        RGBQUAD icColors[1]; // Color table
        BYTE icXOR[1]; // DIB bits for XOR mask
        BYTE icAND[1]; // DIB bits for AND mask
        } ICONIMAGE, *LPICONIMAGE;

        you can use it to modify the bitmap this[^] page gives more info.


        C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

        L Offline
        L Offline
        lastgen
        wrote on last edited by
        #3

        Thanks for the link. When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!

        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