Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ListView Colors..weird

ListView Colors..weird

Scheduled Pinned Locked Moved C / C++ / MFC
c++jsonquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bengi
    wrote on last edited by
    #1

    Anyone knows a reason why this would not paint my items/sub items ?

    case WM_NOTIFY:
    {
    switch(LOWORD(wParam))
    {
    case IDC_LIST:
    {
    if(((LPNMHDR)lParam)->code == NM_CUSTOMDRAW)
    {
    NMLVCUSTOMDRAW *cdraw = (NMLVCUSTOMDRAW*)lParam;

                 if (cdraw->nmcd.dwDrawStage == CDDS\_PREPAINT)
                     return CDRF\_NOTIFYITEMDRAW;
    
                 if (cdraw->nmcd.dwDrawStage == CDDS\_ITEMPREPAINT || cdraw->nmcd.dwDrawStage == CDDS\_SUBITEM)
                 {      
                    COLORREF crText;
                            
                     if ( cdraw->iSubItem==2 )
                          crText = RGB(255,0,0);
                     else if ( cdraw->iSubItem==1 )
                          crText = RGB(0,255,0);
                     else
                          crText = RGB(128,128,255);
                            
                     cdraw->clrText = crText;
                            
                     return CDRF\_DODEFAULT;
                 }
                        
              }
    }
    }	
    

    }

    the message never arrives at if (cdraw->nmcd.dwDrawStage == CDDS_ITEMPREPAINT || cdraw->nmcd.dwDrawStage == CDDS_SUBITEM) i have seen other src codes and it all works well there (MFC examples but not API) any brief idea? /- Bengi - \

    B 1 Reply Last reply
    0
    • B Bengi

      Anyone knows a reason why this would not paint my items/sub items ?

      case WM_NOTIFY:
      {
      switch(LOWORD(wParam))
      {
      case IDC_LIST:
      {
      if(((LPNMHDR)lParam)->code == NM_CUSTOMDRAW)
      {
      NMLVCUSTOMDRAW *cdraw = (NMLVCUSTOMDRAW*)lParam;

                   if (cdraw->nmcd.dwDrawStage == CDDS\_PREPAINT)
                       return CDRF\_NOTIFYITEMDRAW;
      
                   if (cdraw->nmcd.dwDrawStage == CDDS\_ITEMPREPAINT || cdraw->nmcd.dwDrawStage == CDDS\_SUBITEM)
                   {      
                      COLORREF crText;
                              
                       if ( cdraw->iSubItem==2 )
                            crText = RGB(255,0,0);
                       else if ( cdraw->iSubItem==1 )
                            crText = RGB(0,255,0);
                       else
                            crText = RGB(128,128,255);
                              
                       cdraw->clrText = crText;
                              
                       return CDRF\_DODEFAULT;
                   }
                          
                }
      }
      }	
      

      }

      the message never arrives at if (cdraw->nmcd.dwDrawStage == CDDS_ITEMPREPAINT || cdraw->nmcd.dwDrawStage == CDDS_SUBITEM) i have seen other src codes and it all works well there (MFC examples but not API) any brief idea? /- Bengi - \

      B Offline
      B Offline
      Bengi
      wrote on last edited by
      #2

      any idea? i kinda need this one fixed badly! /- Bengi - \

      A 1 Reply Last reply
      0
      • B Bengi

        any idea? i kinda need this one fixed badly! /- Bengi - \

        A Offline
        A Offline
        Alexinuk
        wrote on last edited by
        #3

        Have you seen Michael Dunn's article on Custom-Draw in List boxes? It's on this site (can't find link - it's entitled "Neat Things to do with CListCtrl using Custom Draw") - I have successfully followed that example to colour my List Box -Alex

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups