Question

This is for C++ - win32. Basically I've loaded an image (bmp) into a HBITMAP from a file and bitblitted it to the device context for the main window.

How would I call it again in case I want to change the image?

I've called InvalidateRectangle() and UpdateWindow() but that causes the window controls to flicker.

Était-ce utile?

La solution

Normally you invalidate the area (e.g. via InvalidateRect) and let your WM_PAINT handler repaint it. Reasons why you would get flicker often are because you haven't overridden the WM_ERASEBKGND handler, your WM_PAINT handler isn't doing double-buffered painting, or you're invalidating (or repainting) an area larger than you need to.

This page might help: Flicker-free Drawing: Techniques to eliminate flicker from your applications

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top