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.

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top