using System; using System.Collections.Generic; using System.Reflection; using System.Windows.Forms; using System.Linq; using System.Text; namespace AIStrategyWindow { //This snippet of code exposes the DoubleBuffered property of a datagridview. This //Had eliminated the flicker which would happen at every tick of the timer. //This code courtesy of http://bitmatic.com/c/fixing-a-slow-scrolling-datagridview public static class ExtensionMethods { public static void DoubleBuffered(this DataGridView dgv, bool setting) { Type dgvType = dgv.GetType(); PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); pi.SetValue(dgv, setting, null); } } }