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