0

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.

user1255454
  • 669
  • 1
  • 8
  • 18

1 Answers1

2

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

jamesdlin
  • 81,374
  • 13
  • 159
  • 204