WinAPI Double-buffering

牧云@^-^@ 提交于 2019-12-03 08:25:34

Create a bitmap the size of the window, render into that bitmap, and blit that back into the window when you're done.

You can do a pretty straight-forward in-place replacement in your existing code. Instead of using a device context that renders into the window, use one that renders into the bitmap, and only use the original DC to blit the bitmap back.

Be sure to keep the bitmap around - don't create it in every paint call. You just need to recreate it when the window is resized.

Take a look at the following article: Flicker-Free Displays Using an Off-Screen DC.

This article describes a technique for drawing to a window device context (DC) in such a way that the screen does not flicker. The technique is very simple and easy to implement.

I learnt how to prevent flickering from this tutorial several years ago.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!