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 TV_ITEM labels - trasparent help needed plz

CTreeCtrl TV_ITEM labels - trasparent help needed plz

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

    I am am drawing gradient color on CTreeCtrl background and i want to make CTreeCtrl TV_ITEM labels ( text labels 0 trasparent ... I am getting Image transparent but not the text labels next to the image ... thats what is the problem please let me know how to make it thanks in advance

    I 1 Reply Last reply
    0
    • S sarat

      I am am drawing gradient color on CTreeCtrl background and i want to make CTreeCtrl TV_ITEM labels ( text labels 0 trasparent ... I am getting Image transparent but not the text labels next to the image ... thats what is the problem please let me know how to make it thanks in advance

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      This same question was answered yesterday. please read back to get your answer. Iain.

      S 1 Reply Last reply
      0
      • I Iain Clarke Warrior Programmer

        This same question was answered yesterday. please read back to get your answer. Iain.

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

        Thanks Iain, That solution will work only when there is background image is need to be painted I shud not have any background image to me painted coz i am painting Gradient color in background now how to make the lables trasparent? Though in that solution who is calling CTreeCtrlX::SetBkImage(UINT nIDResource)fuction is not there... there is no message who will call the function please help me if u can first of all i shud not use image coz .. gradient color need to me painted .. gradient i have done but the labels...... whats the solution or can you please tell me how i can use the code mentioned in the Article

        I 1 Reply Last reply
        0
        • S sarat

          Thanks Iain, That solution will work only when there is background image is need to be painted I shud not have any background image to me painted coz i am painting Gradient color in background now how to make the lables trasparent? Though in that solution who is calling CTreeCtrlX::SetBkImage(UINT nIDResource)fuction is not there... there is no message who will call the function please help me if u can first of all i shud not use image coz .. gradient color need to me painted .. gradient i have done but the labels...... whats the solution or can you please tell me how i can use the code mentioned in the Article

          I Offline
          I Offline
          Iain Clarke Warrior Programmer
          wrote on last edited by
          #4

          Have a look at the CXTreeCtrl control, and see the parts where they paint a bitmap. Just replace those with drawing a gradient. Just because the answer hasn't been given to you 100%, doesn't mean you can't adapt their work. Iain.

          S 1 Reply Last reply
          0
          • I Iain Clarke Warrior Programmer

            Have a look at the CXTreeCtrl control, and see the parts where they paint a bitmap. Just replace those with drawing a gradient. Just because the answer hasn't been given to you 100%, doesn't mean you can't adapt their work. Iain.

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

            Really thanx please let me know who is calling SetBkImage(UINT nIDResource) in that artcl.. do i need to call that Onerasebakgrnd? or in onPaint()? please let me know wen shud i call SetBkImage(UINT nIDResource)

            I 1 Reply Last reply
            0
            • S sarat

              Really thanx please let me know who is calling SetBkImage(UINT nIDResource) in that artcl.. do i need to call that Onerasebakgrnd? or in onPaint()? please let me know wen shud i call SetBkImage(UINT nIDResource)

              I Offline
              I Offline
              Iain Clarke Warrior Programmer
              wrote on last edited by
              #6

              sarat wrote:

              please let me know who is calling SetBkImage(

              I have no idea. Try putting a breakpoint on that function, and then you'll find out. Iain.

              S 1 Reply Last reply
              0
              • I Iain Clarke Warrior Programmer

                sarat wrote:

                please let me know who is calling SetBkImage(

                I have no idea. Try putting a breakpoint on that function, and then you'll find out. Iain.

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

                there is no souce code is available to debug if i put the code in my app the function is not calling only and SetBkImage() is not a member of CTreeCtrl to over ride its mentioned that it is overridable function

                S 1 Reply Last reply
                0
                • S sarat

                  there is no souce code is available to debug if i put the code in my app the function is not calling only and SetBkImage() is not a member of CTreeCtrl to over ride its mentioned that it is overridable function

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

                  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 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
                    sarat
                    wrote on last edited by
                    #9

                    in my Tree control OnCustomDraw i have written code like this 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; } } } } in that code SetTextColor(RGB(255, 0, 0)); works fine SetBkMode(lplvcd->nmcd.hdc,TRANSPARENT); doesnt work ( it doesnt make TreeCtrl lables trasparent CLeftPaneTreeCtrl is Derived class of CTreeCtrl My I am hosting TreeCtrl on CView derived class MyView and if i uncomment both the lined comented in the code lptvcd->clrTextBk = CLR_NONE ; -> doent work it paints Black background instead of transparent color but any other color for eg lptvcd->clrTextBk = RGB(0,0,225) works fine lptvcd->clrText = (RGB(0,0,255)); -> works fine now I am not able to make lables trasparent but one more thing ... the same method works fine in my CListCtrl with respect to trasparent lables ... ofcouse there r some other probs butfirst i wnana sort out the rpob with tree control transparent labels first am looking for solution please help me out

                    S 1 Reply Last reply
                    0
                    • S sarat

                      in my Tree control OnCustomDraw i have written code like this 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; } } } } in that code SetTextColor(RGB(255, 0, 0)); works fine SetBkMode(lplvcd->nmcd.hdc,TRANSPARENT); doesnt work ( it doesnt make TreeCtrl lables trasparent CLeftPaneTreeCtrl is Derived class of CTreeCtrl My I am hosting TreeCtrl on CView derived class MyView and if i uncomment both the lined comented in the code lptvcd->clrTextBk = CLR_NONE ; -> doent work it paints Black background instead of transparent color but any other color for eg lptvcd->clrTextBk = RGB(0,0,225) works fine lptvcd->clrText = (RGB(0,0,255)); -> works fine now I am not able to make lables trasparent but one more thing ... the same method works fine in my CListCtrl with respect to trasparent lables ... ofcouse there r some other probs butfirst i wnana sort out the rpob with tree control transparent labels first am looking for solution please help me out

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

                      help plzzzzzzzzzzzzz

                      modified on Friday, February 8, 2008 6:19 AM

                      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