Skip to content

Instantly share code, notes, and snippets.

@andylshort
Created March 24, 2018 11:03
Show Gist options
  • Save andylshort/e9e75364eec45f2289bba63d53f9e98a to your computer and use it in GitHub Desktop.
Save andylshort/e9e75364eec45f2289bba63d53f9e98a to your computer and use it in GitHub Desktop.
Force double buffering on any WinForms control
public static void DoubleBuffering(this Control control, bool enable)
{
var method = typeof(Control).GetMethod("SetStyle", BindingFlags.Instance | BindingFlags.NonPublic);
method.Invoke(control, new object[] { ControlStyles.OptimizedDoubleBuffer, enable });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment