Double buffering is used to reduce flickering when painting windows. In many cases, double buffering is entirely unnecessary, but there are some instances where it can improve the appearance of your application.
For example, there are certain situations when using annotations that "flickering" is very difficult to avoid. One such situation occurs when zooming in very quickly on an annotation. To see this, perform the following steps:
Note that you can very clearly see the image being painted, and then the annotation over the image. For a fraction of a second, you can see the image under the annotation.
Now enable the double buffering option, and begin zooming. Notice how there is no flickering.
You can very easily add double buffering to your applications by using the following functions.
To use double buffering, first you must create a double buffer handle using LDoubleBuffer::CreateHandle. The double buffer handle is an argument for all of the double buffering functions.
Next you must decide which paint operations will be double buffered. All such paint operations must be wrapped in LDoubleBuffer::Begin and LDoubleBuffer::End calls.
The LDoubleBuffer::Begin call returns a memory hDC. All subsequent paint operations should use this hDC for painting. To render the contents of the memory hDC, call LDoubleBuffer::End.
The LDoubleBuffer::Begin and LDoubleBuffer::End calls intelligently manage an internal memory hDC. The memory hDC is only reallocated when necessary.
At any time in your application, you can easily enable/disable the double buffering by calling LDoubleBuffer::EnableDoubleBuffer with appropriate arguments. When the double buffering is disabled, all wrapped paint calls paint directly to the screen. When double buffering is enabled, paints are triggered only by calls to LDoubleBuffer::End.
When you are finished double buffering, call LDoubleBuffer::DestroyHandle to free the internally allocated resources.
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document