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. transparent Listbox

transparent Listbox

Scheduled Pinned Locked Moved C / C++ / MFC
question
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
    Lost User
    wrote on last edited by
    #1

    i subclassed the CListBox and override this two functions BOOL CListBoxTrans::OnEraseBkgnd(CDC* pDC) { // TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen return true; //return CListBox::OnEraseBkgnd(pDC); } HBRUSH CListBoxTrans::CtlColor(CDC* pDC, UINT nCtlColor) { // TODO: Attribute des Gerätekontexts hier ändern // TODO: Pinsel ungleich NULL zurückgeben, falls die Behandlungsroutine des übergeordneten nicht aufgerufen werden soll pDC->SetBkMode(TRANSPARENT); return (HBRUSH)::GetStockObject(NULL_BRUSH); //return NULL; } So now my ListBox is transparent , but if i have to scroll the box or i select an item in the box the transparent effect is damaged . There is a really missmatch on the listbox . What do i have to do , that selecting items and scrolling will work in my transparent ListBox ?

    R 1 Reply Last reply
    0
    • L Lost User

      i subclassed the CListBox and override this two functions BOOL CListBoxTrans::OnEraseBkgnd(CDC* pDC) { // TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen return true; //return CListBox::OnEraseBkgnd(pDC); } HBRUSH CListBoxTrans::CtlColor(CDC* pDC, UINT nCtlColor) { // TODO: Attribute des Gerätekontexts hier ändern // TODO: Pinsel ungleich NULL zurückgeben, falls die Behandlungsroutine des übergeordneten nicht aufgerufen werden soll pDC->SetBkMode(TRANSPARENT); return (HBRUSH)::GetStockObject(NULL_BRUSH); //return NULL; } So now my ListBox is transparent , but if i have to scroll the box or i select an item in the box the transparent effect is damaged . There is a really missmatch on the listbox . What do i have to do , that selecting items and scrolling will work in my transparent ListBox ?

      R Offline
      R Offline
      Rassman
      wrote on last edited by
      #2

      If your listbox is transparent then you should be telling the parent to repaint in the way that you require. Invalidate the rectangle in the parent where the transparent control is. Though there is another way, rather than have your listbox transparent, which can cause you extra typing because of z order painting problems, pass the background rectangle (on move or resize of the parent) to the child (your control) and stick the background in. Then of cause you are back in a world where the listbox can take care of itself. We do it for the joy of seeing the users struggle.

      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