Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Here is my question & Also answer by me to
-Remove flickering due to TableLayoutPanel & Panel in windows form.
Posted

1 solution

Completely Remove flickering due to TableLayoutPanel & Panel in windows form go as follows:=-
1. Set double buffered property of Form =true.
2. Paste Following 2 functions in form.cs

#region .. Double Buffered function ..
       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);
        }

       #endregion


#region .. code for Flucuring ..

       protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x02000000;
                return cp;
            }
        }

        #endregion


3. Call SetDoubleBuffered(“TableLaoutPannel_controlName”) for each TableLayoutPannel,Pannel, Splitcontainer, Datagridview & all container controls.
 
Share this answer
 
Comments
ozzto 26-Jul-18 6:24am    
Greaat. Works just fine for a tableLayoutpanel, with UserControls dynamically loaded in different rows and columns. Thanxx
Member 14089908 24-Mar-19 3:33am    
nice article, it solved my problem. Thanks
evry1falls 16-Jan-21 11:05am    
Great, thanks. Works like a charm.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900