Dual buffering can make the animation smoother
Go Back To The image zoom box and play the trackbar
. Did you notice a lot of flashes when dragging the slider? This is because each time the slider moves a little,
paint
the event processor draws white rectangles and images. When your eyes see white rectangles and images that alternate many times every second, they will feel blinking. This is terrible
...
This can be avoided by using a technology called double buffering. This means that each frame is drawn to an invisible
bitmap
up (a" buffer "), it is displayed only after a frame is drawn. The following is how to use this method
bitmap
method:
①
This is a typical useGraphics
To draw the image to the formProgram:
②
You can addBitmap
To act as a buffer in the program. In this way, when the form or control needs to be re-painted, the image can be drawn to the buffer rather than the form.
③
Now a frame has been drawn to an invisibleBitmap
On, we can use
Drawimageunscaled
() Method
Bitmap
Copy back to the form
Graphics
Go. Replication is completed at one time, which avoids flickering.