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. static transparent background

static transparent background

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelpquestion
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.
  • L Offline
    L Offline
    LukeV
    wrote on last edited by
    #1

    Hi, i've created my own tree control from a static window. The background is transparent and all the items have a transparent background when not selected. When and item is selected, I use a brush to fill the background: ::FillRect( hdc, &rBkgr, m_hBackBrush ); When an item is losing focus (being unselected), I do this: ::FillRect( hdc, &rItem, m_hNullBrush ); //Where m_hNullBrush is GetStockObject( NULL_BRUSH ); The problem I have is that the item's background is not being refreshed. It should be transparent so that the static window background should be visible. If I hide the window, the static control will refresh itself correctly. I've tried to use InvalidateRect() and UpdateWindow() but it does not work! What can I do? Thanks!

    B 1 Reply Last reply
    0
    • L LukeV

      Hi, i've created my own tree control from a static window. The background is transparent and all the items have a transparent background when not selected. When and item is selected, I use a brush to fill the background: ::FillRect( hdc, &rBkgr, m_hBackBrush ); When an item is losing focus (being unselected), I do this: ::FillRect( hdc, &rItem, m_hNullBrush ); //Where m_hNullBrush is GetStockObject( NULL_BRUSH ); The problem I have is that the item's background is not being refreshed. It should be transparent so that the static window background should be visible. If I hide the window, the static control will refresh itself correctly. I've tried to use InvalidateRect() and UpdateWindow() but it does not work! What can I do? Thanks!

      B Offline
      B Offline
      BaldwinMartin
      wrote on last edited by
      #2

      Never use UpdateWindow it can cause huge problems. Use say: HBRUSH CColorStatic::CtlColor(CDC* pDC, UINT nCtlColor) { HBRUSH hbr; pDC->SetTextColor(m_crFg); pDC->SetBkColor(m_crBg); hbr = *m_pBrush; return hbr; } Change the m_cr?? values and let the frame handle it. "Naked we come and bruised we go." - James Douglas Morrison Best Wishes, ez_way

      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