All Articles

Software Development - Quick Tips

Following are some quick tips related to Software Development:

Removing flickering of controls in C# windows forms

In windows forms, when form controls are dynamically resized, they may flicker. The following script can be used to remove flickering of form controls:

SetDoubleBuffered(formControlVariable);

public static void SetDoubleBuffered(System.Windows.Forms.Control c)
{
    if (System.Windows.Forms.SystemInformation.TerminalServerSession)
        return;
    System.Reflection.PropertyInfo aProp = typeof(System.Windows.Forms.Control).GetProperty("DoubleBuffered", System.Reflection.BindingFlags.NonPublic
        | System.Reflection.BindingFlags.Instance);
    aProp.SetValue(c, true, null);
}

Published Nov 28, 2024

Tutorials about Web Development, Server Management, Computer Science and more