This article describes the C# double buffering implementation method. Share it for your reference, as follows:
// This call is required for the form designer.InitializeComponent(); // TODO: Add any initialization after InitComponent call(,true); //Open double buffering(,true); (,true); (,true);
1. Create a "virtual canvas" in memory:
Bitmap bmp = new Bitmap(600, 600);
2. Get the Graphics reference of this memory canvas:
Graphics g = (bmp);
3. Draw on this memory canvas:
(brush, i * 10, j * 10, 10, 10);
4. Draw the memory canvas into the window
().DrawImage(bmp, 0, 0);
There are other ways
Add the following code to the constructor
Code 1:
SetStyle(, true); SetStyle(, true); // Erase background is prohibited.SetStyle(, true); // Double buffering
Code 2:
( | | , true); ();
For more information about C# related content, please check out the topic of this site:Introduction to C# object-oriented programming tutorial》、《Tutorial on the usage of common C# controls"and"C# data structure and algorithm tutorial》
I hope this article will be helpful to everyone's C# programming.