Flicker-free Doublebuffering

I draw a grid-work of objects in the panel. when I scroll through the panel quickly, I get a flicker. I thought turning on double buffering might take care of this, but I find that it doesn't completely draw everything, and I am left with no empty sections. can anyone give me suggestions as to what might happen and how i can fix it.

UPDATE:

I found myself creating a graphic using Creategraphics () instead of using a parameter in the paint method

+3
source share
1 answer

How did you set up double buffering?

You must either set the control's DoubleBuffered property to true

public UserControl1()
{
  InitializeComponent();
  this.DoubleBuffered = true;
}

or

SetStyle OptimizedBoubleBuffer AllPaintingInWmPaint

public UserControl1()
{
  InitializeComponent();
  SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);      
}

ControlStyles.AllPaintingInWmPaint WM_ERASEBKGND. , . DoubleBuffered true, SetStyle, .

+1

Source: https://habr.com/ru/post/1744613/


All Articles