CListCtrl *ptrListHistory; afx_msg void OnNMCustomdrawListHistory(NMHDR *pNMHDR, LRESULT *pResult); void CCylanceCollectDlg::OnNMCustomdrawListHistory(NMHDR *pNMHDR, LRESULT *pResult) { LPNMLVCUSTOMDRAW pLVCD = reinterpret_cast<lpnmlvcustomdraw>(pNMHDR); *pResult = CDRF_DODEFAULT; switch(pLVCD->nmcd.dwDrawStage) { case CDDS_PREPAINT: *pResult = CDRF_NOTIFYITEMDRAW; break; case CDDS_ITEMPREPAINT: { /*COLORREF crText; if ( (pLVCD->nmcd.dwItemSpec) == 0 ) crText = RGB(0,0,255);*/ /*else if ( (pLVCD->nmcd.dwItemSpec % 3) == 1 ) crText = RGB(0,255,0);*/ // Store the color back in the NMLVCUSTOMDRAW struct. /*pLVCD->clrText = crText;*/ // Tell Windows to paint the control itself. *pResult = CDRF_NOTIFYPOSTPAINT; } break; case (CDDS_ITEMPREPAINT | CDDS_SUBITEM): { LVITEM rItem; int nItem = static_cast<int>( pLVCD->nmcd.dwItemSpec ); ZeroMemory ( &rItem, sizeof(LVITEM) ); rItem.mask = LVIF_IMAGE | LVIF_STATE; rItem.iItem = nItem; rItem.stateMask = LVIS_SELECTED; ptrListHistory->GetItem(&rItem);//.GetItem ( &rItem ); *pResult = CDRF_NEWFONT; return; //if(lpLVCustomDraw->iSubItem == 1) //{ ////if(lpLVCustomDraw->nmcd.lItemlParam) //{ // lpLVCustomDraw->clrText = RGB(255, 0, 0); // } //} // *pResult = CDRF_NEWFONT; // return; } default: break; } }
My problem is i want to highlight a row based on the cell value of CListCtrl. for example I have the following rows in my listcontrol SNo URl LastVisitDate 1 https://accounts.google.com/ServiceLoginAuth 20/03/2014 11:22:57 2 https://accounts.google.com/ServiceLoginAuth 20/03/2014 11:22:39 3 https://accounts.google.com/ServiceLoginAuth 20/03/2014 11:22:16 4 https://accounts.google.com/ServiceLoginAuth 20/03/2014 11:22:07 So from the above rows I want highlight a row when i clicked on tree node based on the recent LastVisitDate value in CListCtrl in the mfc application
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)