The implementation method of GDI double buffering of net WINFORM
- 2021-10-16 01:23:04
- OfStack
Sometimes flash occurs when performing continuous GDI + operations in the form. In addition to modifying the parameters of the form, the problem of refreshing itself should be solved. Double buffering may come from this way.
Method 1:
Draw on the bitmap with GDI, and then rebuild the bitmap
Bitmap bt = new Bitmap(510, 510);
Graphics g = Graphics.FromImage(bt);
g.DrawEllipse(Pens.Red, 100, 100, new Random().Next(1, 60), 50);
g.Dispose();
gb.DrawImage(bt,0,0);
gb.Dispose();