I want use Customedraw function which provide by MFC for tree control
But I have few bit problems on when I have tried with List Item data test its working fine
But when I have put for loop for my vector data its showing in drawing ITEM in all Items but I want as condition bellow.
long lListCount = TreeView_GetCount(htree);
for ( int lListCounter = 0 ; lListCounter <= lListCount ; lListCounter ++)
{
// Vector size is equal to same as list size
CString strDiscountIndicator = m_invcoll->m_vec_discount_price_indc.at(lListCounter);
if (strDiscountIndicator == "Y")
{
RECT rc;
TreeView_GetItemRect(htree, (HTREEITEM) pCustomDraw->nmcd.dwItemSpec, &rc, 1);
int temp = rc.left;
rc.top += 1;
rc.left = rc.right ;// GAP_SIZE Use for Space between item text if need ful
rc.right += temp + rc.right ;
int nOldClr = SetTextColor(pCustomDraw->nmcd.hdc, RGB(0,255,0));
DrawText(pCustomDraw->nmcd.hdc, "NEW COLOUR WITH DATA", -1, &rc, DT_LEFT);
SetTextColor(pCustomDraw->nmcd.hdc, nOldClr);
*pResult = CDRF_NOTIFYPOSTPAINT;
}
}
*pResult = CDRF_SKIPDEFAULT;
working Code for Item data comparision.
---------------------------------------
RECT rc;
TreeView_GetItemRect(htree, (HTREEITEM) pCustomDraw->nmcd.dwItemSpec, &rc, 1);
int temp = rc.left;
rc.top += 1;
rc.left = rc.right ;// GAP_SIZE Use for Space between item text if need ful
rc.right += temp + rc.right ;
int nOldClr = SetTextColor(pCustomDraw->nmcd.hdc, RGB(0,255,0));
DrawText(pCustomDraw->nmcd.hdc, "NEW COLOUR WITH DATA", -1, &rc, DT_LEFT);
SetTextColor(pCustomDraw->nmcd.hdc, nOldClr);
*pResult = CDRF_NOTIFYPOSTPAINT;