RE: CTreeCtrl Item labels - are painted with black background instead
any help?
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