Click here to Skip to main content
15,918,003 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Linux For Developers Pin
Nemanja Trifunovic1-Feb-02 10:25
Nemanja Trifunovic1-Feb-02 10:25 
GeneralRe: Linux For Developers Pin
Tim Smith1-Feb-02 12:32
Tim Smith1-Feb-02 12:32 
GeneralRe: Linux For Developers Pin
Hadi Rezaee1-Feb-02 10:27
Hadi Rezaee1-Feb-02 10:27 
GeneralRe: Linux For Developers Pin
valikac1-Feb-02 11:41
valikac1-Feb-02 11:41 
GeneralProblem with Customdraw and a list control Pin
RobJones1-Feb-02 6:00
RobJones1-Feb-02 6:00 
GeneralRe: Problem with Customdraw and a list control Pin
User 66581-Feb-02 7:42
User 66581-Feb-02 7:42 
GeneralRe: Problem with Customdraw and a list control Pin
RobJones1-Feb-02 8:03
RobJones1-Feb-02 8:03 
GeneralRe: Problem with Customdraw and a list control Pin
User 66581-Feb-02 8:25
User 66581-Feb-02 8:25 
Well, since this drawing code is executed for every single item I think it's not neccessary to use a while()-loop.

Give this code a try, however, it is untested:

void CConsoleView::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
    NMLVCUSTOMDRAW* pLVCD = reinterpret_cast( pNMHDR );

    // Take the default processing unless we set this to something else below.
    *pResult = CDRF_DODEFAULT;

    // First thing - check the draw stage. If it's the control's prepaint
    // stage, then tell Windows we want messages for every item.

if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
    *pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
    // This is the prepaint stage for an item. Here's where we set the
    // item's text color. Our return value will tell Windows to draw the
    // item itself, but it will use the new color we set here.

    COLORREF crText;

    if(!GetListCtrl().GetItemText(pLVCD->nmcd.dwItemSpec,7).Compare("Stopped"))
       crText = RGB(255,0,0);
    else
       crText = RGB(0,0,0);

    // Store the color back in the NMLVCUSTOMDRAW struct.
    pLVCD->clrText = crText;

   // Tell Windows to paint the control itself.
   *pResult = CDRF_DODEFAULT; 
}


regards
Gregor

modified 12-Sep-18 21:01pm.

GeneralRe: Problem with Customdraw and a list control Pin
RobJones1-Feb-02 8:33
RobJones1-Feb-02 8:33 
GeneralRe: Problem with Customdraw and a list control Pin
User 66581-Feb-02 8:50
User 66581-Feb-02 8:50 
GeneralRe: Problem with Customdraw and a list control Pin
RobJones1-Feb-02 8:54
RobJones1-Feb-02 8:54 
GeneralRe: Problem with Customdraw and a list control Pin
User 66581-Feb-02 9:01
User 66581-Feb-02 9:01 
GeneralRe: Problem with Customdraw and a list control Pin
RobJones1-Feb-02 8:58
RobJones1-Feb-02 8:58 
Question????????? Pin
#realJSOP1-Feb-02 5:56
professional#realJSOP1-Feb-02 5:56 
AnswerRe: ????????? Pin
Joaquín M López Muñoz1-Feb-02 6:04
Joaquín M López Muñoz1-Feb-02 6:04 
AnswerRe: ????????? Pin
wangyiming1-Feb-02 15:01
wangyiming1-Feb-02 15:01 
QuestionHow I can Know the cpu in MSDOS? Pin
Carlos Antollini1-Feb-02 4:28
Carlos Antollini1-Feb-02 4:28 
AnswerRe: How I can Know the cpu in MSDOS? Pin
Joaquín M López Muñoz1-Feb-02 5:54
Joaquín M López Muñoz1-Feb-02 5:54 
GeneralRe: How I can Know the cpu in MSDOS? Pin
Carlos Antollini1-Feb-02 6:01
Carlos Antollini1-Feb-02 6:01 
AnswerRe: How I can Know the cpu in MSDOS? Pin
Joaquín M López Muñoz1-Feb-02 6:01
Joaquín M López Muñoz1-Feb-02 6:01 
GeneralRe: How I can Know the cpu in MSDOS? Pin
Carlos Antollini1-Feb-02 6:06
Carlos Antollini1-Feb-02 6:06 
QuestionHow to get the y coordinate of a PolyBezier spline Pin
1-Feb-02 3:56
suss1-Feb-02 3:56 
GeneraladdObject() Pin
1-Feb-02 3:42
suss1-Feb-02 3:42 
GeneralRe: addObject() Pin
Jon Hulatt1-Feb-02 4:09
Jon Hulatt1-Feb-02 4:09 
GeneralProblem with menu/activex control event Pin
Roger Allen1-Feb-02 3:28
Roger Allen1-Feb-02 3:28 

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.