what’s wrong in the code

Hello Friend what’s wrong in the code
I need Showing draw Elements in few Items which is in List of tree control but its show in all List Item so please let me know problem in Loop .
If you are not Understand my problem so go thought this link and download sample application and Changed the code as mine
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q248496


case CDDS_ITEMPOSTPAINT:
{
TCHAR szFace[LF_FACESIZE];
HTREEITEM hItem = (HTREEITEM) pNMTVCD->nmcd.dwItemSpec;
TVITEM tvi = { 0 };
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = hItem;
tvi.pszText = szFace;
tvi.cchTextMax = sizeof(szFace)/sizeof(TCHAR);

TreeView_GetItem(hWndTreeView, &tvi);

int n = TreeView_GetCount(hWndTreeView);
//for (int i=0; i<n ; i++)
int i =9;// i need only in 9th elments with test "Sample draw"
{
if (tvi.lParam)
{
CItemData *pItemData = (CItemData *) tvi.lParam;
if (pItemData)
{
if (pItemData->m_itemType == ITEM_COLORS)
{
//if ((pNMTVCD->nmcd.uItemState & CDIS_FOCUS) == CDIS_FOCUS)
{
// Draw the Color Text
if (i == 9 )
{
RECT rc;
TreeView_GetItemRect(hWndTreeView, (HTREEITEM) pNMTVCD->nmcd.dwItemSpec, &rc, 1);

int temp = rc.left;
//rc.top += 1;
rc.left = rc.right + GAP_SIZE;
rc.right += temp + rc.right + GAP_SIZE;

int nOldClr = SetTextColor(pNMTVCD->nmcd.hdc, RGB(0,0,255));
DrawText(pNMTVCD->nmcd.hdc,L"Sample draw" , -1, &rc, DT_LEFT);
SetTextColor(pNMTVCD->nmcd.hdc, nOldClr);
}
else
{
/// empty draw for rest item node
}
}
//else
//{
// Erase the Color Text drawn previously
// FillRect(pNMTVCD->nmcd.hdc, &rc, (HBRUSH) (COLOR_WINDOW+1));
//}
}
else if (pItemData->m_itemType == ITEM_FONTS)
{
}
}
}
}
return CDRF_DODEFAULT;
}


please let me know its gr8 help for me
Topic archived. No new replies allowed.