Click here to Skip to main content
15,869,940 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I need to invalidate different areas on a screen at the same time (occurring in the same function).

I could invoke the InvalidateRect(&rc) for each area:
InvalidateRect(&rc);
InvalidateRect(&rc2);

or I could create a region and add the rectangles to the region and then use InvalidateRgn(&rgn);

I've done both and can't really tell any difference. I'm not convinced when I use the InvalidateRect() method to invalidate each rectangle that WM_PAINT is firing for each call. If it isn't, I'm not sure of the advantage I'm receiving by invalidating a region (consisting of the disparate rectangles).

Any thoughts or opinions would be appreciated.
Posted
Updated 14-May-10 6:17am
v2
Comments
Moak 14-May-10 12:18pm    
Updated subject and tags, hope this is what you are looking for.

1 solution

23_444 wrote:
I'm not convinced ... that WM_PAINT is firing for each call.


You are correct, these calls tend to get collected together and then the app gets a single WM_PAINT message for an accumulation of more than one of the invalidated regions. As to the advantages of doing it this way, that depends entirely on your application and what it is trying to display at any time. Take a look at the MSDN documentation[^] for more information.
 
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