If you draw images in the Form, no matter whether the dual cache is used or not, you will see that the images will continuously flash during update, the solution is to add the following three lines of code to the constructor of the form:
Add the following lines to the constructor:
SetStyle (ControlStyles. UserPaint, true );
SetStyle (ControlStyles. AllPaintingInWmPaint, true); // The background cannot be erased.
SetStyle (ControlStyles. DoubleBuffer, true); // Double Buffer
Parameter description:
UserPaint
If it is true, the control will be drawn by itself, rather than by the operating system. This style applies only to classes derived from Control.
AllPaintingInWmPaint
If true, the control ignores the WM_ERASEBKGND window message to reduce flickering. This style should be applied only when the UserPaint bit is set to true.
DoubleBuffer
If this parameter is set to true, the image is drawn in the buffer and the result is output to the screen. The dual buffer can prevent flickering caused by control re-painting. To fully enable double buffering, you must also set the UserPaint and AllPaintingInWmPaint style bits to true.