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 do transparent color in the CBitmapButton? [modified]

How to do transparent color in the CBitmapButton? [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
helpgraphicstutorialquestion
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.
  • R Offline
    R Offline
    Romiks
    wrote on last edited by
    #1

    Hi all, I have created the button in my project like this: CBitmapButton m_mainSettings; DDX_Control(pDX, IDC_MAIN_SETTINGS, m_mainSettings); m_mainSettings.LoadBitmaps(IDB_BITMAP1); m_mainSettings.SizeToContent(); All works good, except greyed frame arround bitmap. So I need to add a transparent color for the bitmap. Please help me to resolve the problem. -- modified at 14:38 Sunday 17th June, 2007

    M 1 Reply Last reply
    0
    • R Romiks

      Hi all, I have created the button in my project like this: CBitmapButton m_mainSettings; DDX_Control(pDX, IDC_MAIN_SETTINGS, m_mainSettings); m_mainSettings.LoadBitmaps(IDB_BITMAP1); m_mainSettings.SizeToContent(); All works good, except greyed frame arround bitmap. So I need to add a transparent color for the bitmap. Please help me to resolve the problem. -- modified at 14:38 Sunday 17th June, 2007

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

      AFAIK, CBitmapButton doesn't support transparent colors. You could derive a class from CBitmapButton, override the DrawItem() method, and draw the bitmaps yourself using transparency, perhaps with GDI+ or masked bitmaps. CBitmapButton uses BitBlt() to draw the bitmaps. An easier (IMO) approach would be to use a toolbar control. There you can use image list(s) which will handle transparency and true-color bitmaps easily. Mark

      "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

      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