I am a student learning to do C++ programming with MFC. I have used
InvalidateRect to update a particular area in a program. I thought invalidating reduced the flickering of an area/graphics when you repaint it, but it doesn’t really solve the problem. Is there any other way to reduce the flickering of an area/graphics when you repaint it?
ValidateRect might be closer to what you want, because flickering is caused by repainting the same window several times. Calling
InvalidateRect simply tells Windows that a portion of a window must be painted.
InvalidateRect can help is that you can create a single place in your code that paints your entire window. Then, if you make several changes to your data, you can invalidate the window, which will call this code. The result is that everything is painted at once rather in several pieces.
It’s hard for me to get more specific without knowing what your code does, but my guess is that you should step through your code that paints the screen and see what causes the flicker. Try and design your code so that your window is updated all at once.