How to avoid flicker while handling WM_ERASEBKGND in Windows dialog

后端 未结 6 1301
梦谈多话
梦谈多话 2020-12-17 19:41

I have a dialog that resizes. It also has a custom background which I paint in response to a WM_ERASEBKGND call (currently a simple call to FillSolidRect).

When t

6条回答
  •  长情又很酷
    2020-12-17 20:33

    Do nothing in the WM_ERASEBKGND handling and do the erase as part of your main WM_PAINT. You can either paint smarter so that you only redraw the invalid areas, or more easily, double-buffer the drawing.

    By not doing anything in the erase background, you have all your drawing code in one location which should make it easier for others to follow and maintain.

提交回复
热议问题