Click here to Skip to main content
15,918,007 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends
I want to change the color of text in only one row in listctrl. My program I must do it in OnTimer procedure.
So I created class CMoja1ListCtrl drived from CListCtrl and implemented an NM_CUSTOMDRAW message handler.
Everything like in this article : http://msdn.microsoft.com/en-us/library/ms364048(VS.80).aspx
Now how to pass to OnNMCustomdraw number of row I want to change ? SendMessage(NM_CUSTOMDRAW,0,linenumber) ?
Any suggestions?
I would be very grateful if someone help me with this problem.
Posted
Updated 11-Oct-11 4:22am
v2

The important thing to note is that you do not fire the NM_CUSTOMDRAW event yourself. You only handle the event which is fired by the underlying code at the appropriate time for drawing.
So, if you want to change an item colour at a particular time, you must invalidate the list control to force a redraw (causing the NM_CUSTOMDRAW event to fire) and let your handler change the colour as required.
In your case I guess your timer handler will do the invalidation and perhaps set up a colour which your custom draw handler can use.
 
Share this answer
 
Comments
richard.alpert 11-Oct-11 16:11pm    
Thank you, now I must solve flickering problem
Did you see this[^] page at MSDN?

When your code is called, (via a NM_CUSTOMDRAW message) you can determine that the handler has been called for a listview or a tree-view then treat the data pointed to by lParam in the appropriate way .

In the case of a listview, the data is a NMLVCUSTOMDRAW struct, the first member of which NMCUSTOMDRAW struct. Inside this NMCUSTOMDRAW struct is a member called dwItemSpec. This contains your item number.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900