Tablayout panel taking too long time to load

133 Views Asked by At

i have below form where i have several controls in Tablayout panel, as show in image.

enter image description here

its taking too long time(and also flicker) when i load this form.

i tried : i select CellBorderStyle as a 'None' so, that moment i didnt observe this issue, but the moment i choose any cellBorder style apart from 'None' its appears.

PS; i didn't perform any operation while form loading. just trying to load initial form.

2

There are 2 best solutions below

1
Tor On BEST ANSWER

Try DoubleBuffered property to avoid flickering. You will have to create a subclass from TableLayoutPanel to set the DoubleBuffered property to true.

0
VARUN NAYAK On

Below is Complete answer as Tor suggested .

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);
}

i called upperfunction from form Constructor

SetDoubleBuffered("tablayoutPanelName");