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:
Run the main C API annotation demo (annot32.exe).
Load an image.
Draw a button annotation.
In the View menu, disable double buffering.
Hold the "+" key to zoom in very quickly.
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 L_DoubleBufferCreateHandle. The double buffer handle is an argument for all of the double buffering functions.
The L_DoubleBufferBegin call returns a memory hDC. All subsequent paint operations should use this hDC for painting. To render the contents of the memory hDC, call L_DoubleBufferEnd.
The L_DoubleBufferBegin and L_DoubleBufferEnd 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 L_DoubleBufferEnable 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 L_DoubleBufferEnd.
When you are finished double buffering, call L_DoubleBufferDestroyHandle to free the internally allocated resources.
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries