CTreeCtrl TV_ITEM labels - trasparent help needed plz
-
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 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
This same question was answered yesterday. please read back to get your answer. Iain.
-
This same question was answered yesterday. please read back to get your answer. Iain.
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
-
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
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.
-
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.
-
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)
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.
-
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.
-
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
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; } } } }
-
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; } } } }
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
-
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