Click here to Skip to main content
15,890,897 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionrtd server Pin
trioum7-May-10 0:01
trioum7-May-10 0:01 
QuestionGeneral Guidelines For C++ library development Pin
Ahmed Charfeddine6-May-10 22:12
Ahmed Charfeddine6-May-10 22:12 
AnswerRe: General Guidelines For C++ library development Pin
Emilio Garavaglia6-May-10 23:44
Emilio Garavaglia6-May-10 23:44 
AnswerRe: Walkthrough: Creating and Using a Static Library Pin
Software_Developer7-May-10 0:12
Software_Developer7-May-10 0:12 
QuestionCustom Draw -ListView win32 Pin
arun_pk6-May-10 22:09
arun_pk6-May-10 22:09 
AnswerRe: Custom Draw -ListView win32 Pin
Code-o-mat6-May-10 22:21
Code-o-mat6-May-10 22:21 
GeneralRe: Custom Draw -ListView win32 Pin
arun_pk6-May-10 22:24
arun_pk6-May-10 22:24 
GeneralRe: Custom Draw -ListView win32 Pin
Stuart Dootson6-May-10 23:38
professionalStuart Dootson6-May-10 23:38 
I have done exactly this...

In your (MFC) NM_CUSTOMDRAW handler, you need code like this:

void whtever the clas name is::OnCustomDraw(NMHDR *pNMHDR, LRESULT *pResult)
{
   LPNMLVCUSTOMDRAW pNMLVCD = reinterpret_cast<LPNMLVCUSTOMDRAW>(pNMHDR);
   *pResult = CDRF_DODEFAULT;
   switch(pNMLVCD->nmcd.dwDrawStage)
   {
   case CDDS_PREPAINT:
      *pResult = CDRF_NOTIFYITEMDRAW;
      break;
   case CDDS_ITEMPREPAINT:
      {
         const COLORREF mainColor = whatever the background text colour is;
         const COLORREF altColor = whatever the alternate background colour is;
         const COLORREF mainTextColor = whatever the main text colour is;
         const COLORREF altTextColor = whatever the alternate text colour is;
         const size_t row = pNMLVCD->nmcd.dwItemSpec;
         pNMLVCD->clrTextBk = (1==row%2)?altColor:mainColor;
         pNMLVCD->clrText = (1==row%2)?altTextColor:mainTextColor;
         *pResult = CDRF_NEWFONT;
      }
      break;
   };
}

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

CodeProject MVP for 2010 - who'd'a thunk it!

GeneralRe: Custom Draw -ListView win32 Pin
arun_pk7-May-10 2:30
arun_pk7-May-10 2:30 
GeneralRe: Custom Draw -ListView win32 Pin
Stuart Dootson7-May-10 2:33
professionalStuart Dootson7-May-10 2:33 
GeneralRe: Custom Draw -ListView win32 Pin
arun_pk7-May-10 2:41
arun_pk7-May-10 2:41 
GeneralRe: Custom Draw -ListView win32 Pin
Stuart Dootson7-May-10 2:44
professionalStuart Dootson7-May-10 2:44 
GeneralRe: Custom Draw -ListView win32 Pin
arun_pk7-May-10 2:47
arun_pk7-May-10 2:47 
GeneralRe: Custom Draw -ListView win32 Pin
arun_pk7-May-10 3:01
arun_pk7-May-10 3:01 
GeneralRe: Custom Draw -ListView win32 Pin
Stuart Dootson7-May-10 3:05
professionalStuart Dootson7-May-10 3:05 
GeneralRe: Custom Draw -ListView win32 Pin
arun_pk7-May-10 3:11
arun_pk7-May-10 3:11 
GeneralRe: Custom Draw -ListView win32 Pin
Code-o-mat6-May-10 23:45
Code-o-mat6-May-10 23:45 
AnswerRe: Custom Draw -ListView win32 Pin
David Crow7-May-10 3:35
David Crow7-May-10 3:35 
QuestionGeo Location Using IP address Pin
john56326-May-10 20:02
john56326-May-10 20:02 
AnswerRepost. Pin
CPallini6-May-10 20:53
mveCPallini6-May-10 20:53 
GeneralRe: Repost. Pin
john56326-May-10 20:54
john56326-May-10 20:54 
GeneralRe: Repost. Pin
CPallini6-May-10 20:57
mveCPallini6-May-10 20:57 
GeneralRe: Repost. Pin
john56326-May-10 21:09
john56326-May-10 21:09 
GeneralRe: Repost. Pin
CPallini6-May-10 21:15
mveCPallini6-May-10 21:15 
GeneralRe: Repost. Pin
john56326-May-10 21:27
john56326-May-10 21:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.