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); |
Thank you very much. It works well to stop tabPages redraw without affecting other controls.
This worked great for me too. A really easy, effective solution.
Thank you so much!
I spent two hours on searching the web for a solution to prevent flickering in my listview. This solution worked for me and it is very simple as it describes the solution clear and briefly.
Many Thanks,
Andreas