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. CTreeCtrl labels - are painted with black background instead of trasparent Help needed plz

CTreeCtrl labels - are painted with black background instead of trasparent Help needed plz

Scheduled Pinned Locked Moved C / C++ / MFC
dotnethelp
6 Posts 3 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.
  • S Offline
    S Offline
    sarat
    wrote on last edited by
    #1

    hi I implimented CustomDraw when i put lptvcd->clrTextBk = CLR_NONE ; lables are painted with black color background but not trasparent please some one tell me what shud i change in the code to get the CtreeCtrl lables trasparent void CLeftPaneTreeCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult) { switch(pNMHDR->code) { case NM_CUSTOMDRAW: { LPNMTVCUSTOMDRAW lptvcd = (LPNMTVCUSTOMDRAW )pNMHDR; lptvcd->clrTextBk = CLR_NONE ; lptvcd->clrText = (RGB(0,0,255)); //SetTextColor(RGB(255, 0, 0)); //SetBkMode(lplvcd->nmcd.hdc,TRANSPARENT); switch (lplvcd->nmcd.dwDrawStage) { case CDDS_PREPAINT: // Need to process this case and set pResult to // CDRF_NOTIFYITEMDRAW, otherwise parent will never receive //CDDS_ITEMPREPAINT notification. (GGH) *pResult = CDRF_NOTIFYITEMDRAW; return; } } } }

    K S 2 Replies Last reply
    0
    • S sarat

      hi I implimented CustomDraw when i put lptvcd->clrTextBk = CLR_NONE ; lables are painted with black color background but not trasparent please some one tell me what shud i change in the code to get the CtreeCtrl lables trasparent void CLeftPaneTreeCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult) { switch(pNMHDR->code) { case NM_CUSTOMDRAW: { LPNMTVCUSTOMDRAW lptvcd = (LPNMTVCUSTOMDRAW )pNMHDR; lptvcd->clrTextBk = CLR_NONE ; lptvcd->clrText = (RGB(0,0,255)); //SetTextColor(RGB(255, 0, 0)); //SetBkMode(lplvcd->nmcd.hdc,TRANSPARENT); switch (lplvcd->nmcd.dwDrawStage) { case CDDS_PREPAINT: // Need to process this case and set pResult to // CDRF_NOTIFYITEMDRAW, otherwise parent will never receive //CDDS_ITEMPREPAINT notification. (GGH) *pResult = CDRF_NOTIFYITEMDRAW; return; } } } }

      K Offline
      K Offline
      KarstenK
      wrote on last edited by
      #2

      What happens if // lptvcd->clrTextBk = CLR_NONE ; dont get to work?

      Greetings from Germany

      S 1 Reply Last reply
      0
      • K KarstenK

        What happens if // lptvcd->clrTextBk = CLR_NONE ; dont get to work?

        Greetings from Germany

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

        Hi Karstenk Thanx for the reply if i coment out that line it will paint white background but i painted gradient color on CTreeCtrl backgoud so it doest help me and one more thing lplvcd->clrTextBk = CLR_NONE ; works fine with CListCtrl lables but same thing doesnt work for CTreeCtrl lables and any other color other than trasparent will take effect properly -SetBkMode(hdc,TRASPARENT) also wont work - it doesnt take any effect

        1 Reply Last reply
        0
        • S sarat

          hi I implimented CustomDraw when i put lptvcd->clrTextBk = CLR_NONE ; lables are painted with black color background but not trasparent please some one tell me what shud i change in the code to get the CtreeCtrl lables trasparent void CLeftPaneTreeCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult) { switch(pNMHDR->code) { case NM_CUSTOMDRAW: { LPNMTVCUSTOMDRAW lptvcd = (LPNMTVCUSTOMDRAW )pNMHDR; lptvcd->clrTextBk = CLR_NONE ; lptvcd->clrText = (RGB(0,0,255)); //SetTextColor(RGB(255, 0, 0)); //SetBkMode(lplvcd->nmcd.hdc,TRANSPARENT); switch (lplvcd->nmcd.dwDrawStage) { case CDDS_PREPAINT: // Need to process this case and set pResult to // CDRF_NOTIFYITEMDRAW, otherwise parent will never receive //CDDS_ITEMPREPAINT notification. (GGH) *pResult = CDRF_NOTIFYITEMDRAW; return; } } } }

          S Offline
          S Offline
          Shog9 0
          wrote on last edited by
          #4

          You're gonna have to draw the labels yourself.

          But who is the king of all of these folks?

          S 1 Reply Last reply
          0
          • S Shog9 0

            You're gonna have to draw the labels yourself.

            But who is the king of all of these folks?

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

            how to do that can u please give me some pointers how to start drawing the lables and where in customdraw?

            S 1 Reply Last reply
            0
            • S sarat

              how to do that can u please give me some pointers how to start drawing the lables and where in customdraw?

              S Offline
              S Offline
              Shog9 0
              wrote on last edited by
              #6

              Check out the articles under: Tree Controls - Custom Tree Controls[^]

              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