Tag Archives: double buffering
Enable Double Buffering for Controls to reduce flickering
Some controls do not have their DoubleBuffered
property listed in the properties window. For this reason it requires an additional step to enable double buffering for specific controls such as a ListView control.
If you wish to enable the DoubleBuffed
property of a control simply use the method provided below.
1 2 3 4 5 6 | public static void SetDoubleBuffering(System.Windows.Forms.Control control, bool value) { System.Reflection.PropertyInfo controlProperty = typeof(System.Windows.Forms.Control) .GetProperty("DoubleBuffered", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); controlProperty.SetValue(control, value, null); } |
Example
1 | SetDoubleBuffering(listView1, true); |
Posted in C#.
Tagged C#, csharp, double buffering, DoubleBuffered, snippet, winforms