`

自己写的一段customerDraw

    博客分类:
  • MFC
 
阅读更多

void CNewReportPage::OnNMCustomdrawRightbottomModel2List(NMHDR *pNMHDR, LRESULT *pResult)
{
 LPNMLVCUSTOMDRAW pLVCD = reinterpret_cast<LPNMLVCUSTOMDRAW>(pNMHDR);
 int      nItem = static_cast<int>(pLVCD->nmcd.dwItemSpec);

 if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
    {
       *pResult = CDRF_NOTIFYITEMDRAW;
    }
 if(CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
 {
  *pResult = CDRF_NOTIFYSUBITEMDRAW;
  
  //*pResult = CDRF_NOTIFYPOSTPAINT;
 }
 if((CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage)
 {
  //CHANGE THE COLOR OF TEXT
  COLORREF textColor;
  if(pLVCD->iSubItem == 2){
   textColor = RGB(0,0,255);
   *pResult = CDRF_DODEFAULT;
  }else if(pLVCD->iSubItem == 4){
   //LoadImageListForRightBottomModel2List(nItem,IDB_BITMAP_REPORT,pLVCD);
   textColor = RGB(0,0,0);
   *pResult = CDRF_NOTIFYSUBITEMDRAW|CDRF_NOTIFYPOSTPAINT;
   //*pResult = CDRF_NOTIFYSUBITEMDRAW|CDRF_NOTIFYPOSTPAINT;
  }else if(pLVCD->iSubItem == 5){
   //LoadImageListForRightBottomModel2List(nItem,IDB_BITMAP_MODIFY,pLVCD);
   textColor = RGB(0,0,0);
   *pResult = CDRF_NOTIFYSUBITEMDRAW|CDRF_NOTIFYPOSTPAINT;
   //*pResult = CDRF_SKIPDEFAULT;
  }else if(pLVCD->iSubItem == 6){
   //LoadImageListForRightBottomModel2List(nItem,IDB_BITMAP_DELETE,pLVCD);
   textColor = RGB(0,0,0);
   *pResult = CDRF_NOTIFYSUBITEMDRAW|CDRF_NOTIFYPOSTPAINT;
   //*pResult = CDRF_SKIPDEFAULT;
  }else{
   textColor = RGB(0,0,0);
   //*pResult = CDRF_DODEFAULT;
  }
  pLVCD->clrText = textColor;
  //*pResult = CDRF_NOTIFYPOSTPAINT; 

 }
 if( (CDDS_ITEMPOSTPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage )
 {
  int i =0;
  if(pLVCD->iSubItem == 4){
   /* if ( rItem.state & LVIS_SELECTED ){*/
     LoadImageListForRightBottomModel2List(nItem,IDB_BITMAP_REPORT,pLVCD);
     *pResult = CDRF_SKIPDEFAULT;
   /* }else{
    *pResult = CDRF_DODEFAULT;
    }*/
  }else if(pLVCD->iSubItem == 5){
   LoadImageListForRightBottomModel2List(nItem,IDB_BITMAP_MODIFY,pLVCD);
     *pResult = CDRF_SKIPDEFAULT;
  }else if(pLVCD->iSubItem == 6){
   LoadImageListForRightBottomModel2List(nItem,IDB_BITMAP_DELETE,pLVCD);
     *pResult = CDRF_SKIPDEFAULT;
  }
 }
 
}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics