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. how to set transparent color for a perticular color

how to set transparent color for a perticular color

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
6 Posts 4 Posters 1 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
    sarat
    wrote on last edited by
    #1

    hi i need to set transparent color for a perticular color so that when i load bit map the color will be transparent... i am working with mfc tool bar controls how to set default transparent color for a perticular color please let me know thanks in advance

    C G M 3 Replies Last reply
    0
    • S sarat

      hi i need to set transparent color for a perticular color so that when i load bit map the color will be transparent... i am working with mfc tool bar controls how to set default transparent color for a perticular color please let me know thanks in advance

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      What are you doing exactly ? Where are you using that bitmap and how do you 'display' it ?


      Cédric Moonen Software developer
      Charting control [v1.2]

      S 1 Reply Last reply
      0
      • C Cedric Moonen

        What are you doing exactly ? Where are you using that bitmap and how do you 'display' it ?


        Cédric Moonen Software developer
        Charting control [v1.2]

        S Offline
        S Offline
        sarat
        wrote on last edited by
        #3

        thanx for the reply i have a bit map lets say smily having red color arrond the smily i wanna put that bit map on the tool bar button but i dont wanna disply the red color i know we can make that red color as transparent color so that it wont be displyed ... but how to set red color as transparent color

        1 Reply Last reply
        0
        • S sarat

          hi i need to set transparent color for a perticular color so that when i load bit map the color will be transparent... i am working with mfc tool bar controls how to set default transparent color for a perticular color please let me know thanks in advance

          G Offline
          G Offline
          GauranG Shah
          wrote on last edited by
          #4

          use SetlayeredWindowAttributes() API to set the red color transparent. might be below link will help you. http://www.codeproject.com/KB/cpp/Greetings.aspx[^]

          [ Screen Capture ][ Tool Tip ][ Muliple Desktops ][Greeting Card ]

          1 Reply Last reply
          0
          • S sarat

            hi i need to set transparent color for a perticular color so that when i load bit map the color will be transparent... i am working with mfc tool bar controls how to set default transparent color for a perticular color please let me know thanks in advance

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

            For button bitmaps in an MFC toolbar, you can use a masked imagelist to hold the bitmaps.

            // in constructor
            // transparent color is bright green
            m\_ToolBarImageList.Create(IDB\_BITMAP1, 16, 1, RGB(0x00,0xFF,0x00));
            

            ...
            // some time after m_ToolBar's is created
            m_ToolBar.GetToolBarCtrl().SetImageList(&m_ToolBarImageList);

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            S 1 Reply Last reply
            0
            • M Mark Salsbery

              For button bitmaps in an MFC toolbar, you can use a masked imagelist to hold the bitmaps.

              // in constructor
              // transparent color is bright green
              m\_ToolBarImageList.Create(IDB\_BITMAP1, 16, 1, RGB(0x00,0xFF,0x00));
              

              ...
              // some time after m_ToolBar's is created
              m_ToolBar.GetToolBarCtrl().SetImageList(&m_ToolBarImageList);

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              S Offline
              S Offline
              sarat
              wrote on last edited by
              #6

              Thanx a lot it works fine

              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