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. Getting transparent icons out of CImageList ?

Getting transparent icons out of CImageList ?

Scheduled Pinned Locked Moved C / C++ / MFC
jsonquestion
4 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.
  • E Offline
    E Offline
    Electronic75
    wrote on last edited by
    #1

    Hello, I'm trying to draw a toolbar with icons designed by myself(which I'm very proud of them:)). I use CImageList to store my icons then I pass my ImageList to CToolBar to do the rest of work. I did not use LoadToolBar because I wanted to have greater control over buttons and their associated pictures. How should I tell to CImageList to get its hand off my icon and do not place a black background behind them. I want background of my icons be color of my framework. This is my code... m_ImageList.SetBkColor(CLR_NONE); //even when I omit this line the result is the same m_ImageList.Add(LoadIcon(hIcon)); ... m_ToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT, WS_CHILD |WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_ToolBar.GetToolBarCtrl().SetImageList(&m_ImageList); ... thanks:)

    M 1 Reply Last reply
    0
    • E Electronic75

      Hello, I'm trying to draw a toolbar with icons designed by myself(which I'm very proud of them:)). I use CImageList to store my icons then I pass my ImageList to CToolBar to do the rest of work. I did not use LoadToolBar because I wanted to have greater control over buttons and their associated pictures. How should I tell to CImageList to get its hand off my icon and do not place a black background behind them. I want background of my icons be color of my framework. This is my code... m_ImageList.SetBkColor(CLR_NONE); //even when I omit this line the result is the same m_ImageList.Add(LoadIcon(hIcon)); ... m_ToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT, WS_CHILD |WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_ToolBar.GetToolBarCtrl().SetImageList(&m_ImageList); ... thanks:)

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      You didn't show how you are creating the image list. It needs to be masked... // assuming icons are 16x16 m_ImageList.Create(16, 16, ILC_COLOR24 | ILC_MASK, 0, 1); ... m_ImageList.Add(LoadIcon(hIcon));

      "Go that way, really fast. If something gets in your way, turn."

      E 1 Reply Last reply
      0
      • M Mark Salsbery

        You didn't show how you are creating the image list. It needs to be masked... // assuming icons are 16x16 m_ImageList.Create(16, 16, ILC_COLOR24 | ILC_MASK, 0, 1); ... m_ImageList.Add(LoadIcon(hIcon));

        "Go that way, really fast. If something gets in your way, turn."

        E Offline
        E Offline
        Electronic75
        wrote on last edited by
        #3

        Thanks a lot mark, you helped me again:). and you solved my problem completely! I was wondering what is your mean from the phrase in your signature

        Mark Salsbery wrote:

        "Go that way, really fast. If something gets in your way, turn."

        Dose it mean one should find the way by trail and error :confused: anyway thanks for all the helps:):rose:

        M 1 Reply Last reply
        0
        • E Electronic75

          Thanks a lot mark, you helped me again:). and you solved my problem completely! I was wondering what is your mean from the phrase in your signature

          Mark Salsbery wrote:

          "Go that way, really fast. If something gets in your way, turn."

          Dose it mean one should find the way by trail and error :confused: anyway thanks for all the helps:):rose:

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Electronic75 wrote:

          I was wondering what is your mean from the phrase in your signature

          That's a quote from the move "Better Off Dead". Those are skiing instructions ;P (they work for extreme programming as well :))

          "Go that way, really fast. If something gets in your way, turn."

          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