Click here to Skip to main content
15,920,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Linux For Developers Pin
Jason Hihn1-Feb-02 9:06
Jason Hihn1-Feb-02 9:06 
GeneralRe: Linux For Developers Pin
Nemanja Trifunovic1-Feb-02 9:54
Nemanja Trifunovic1-Feb-02 9:54 
GeneralRe: Linux For Developers Pin
Tim Smith1-Feb-02 10:23
Tim Smith1-Feb-02 10:23 
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 
Hello,
I am using an example posted in a article by Michael Dunn (I have modified it a bit to fit my needs).. Here is the sample of code that I am using..

void CConsoleView::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
	NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( 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;

		long nItems = GetListCtrl().GetItemCount();

		while(nItems > 0)
		{
			if(!GetListCtrl().GetItemText(nItems-1,7).Compare("Stopped"))
			{
				//if the item is stopped then color it red
				if (long (pLVCD->nmcd.dwItemSpec) == nItems-1 )
				crText = RGB(255,0,0);
			}
			else
			{
				//else color it black
				if (long (pLVCD->nmcd.dwItemSpec) == nItems-1 )
				crText = RGB(0,0,0);
			}
			nItems--;
		}
		
        // Store the color back in the NMLVCUSTOMDRAW struct.
        pLVCD->clrText = crText;

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


The problem that I am having is that the first 2 columns do not get repainted.. the rest of the list gets colored perfectly.. Any ideas?

Thanks,

Rob
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 
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 

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.