本文介绍了消除因TableLayoutPanel& amp;而导致的闪烁Windows格式的面板......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题&我也回答

- 由于Windows窗体中的TableLayoutPanel和Panel而导致闪烁。

Here is my question & Also answer by me to
-Remove flickering due to TableLayoutPanel & Panel in windows form.

推荐答案

#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.调用SetDoubleBuffered(TableLaoutPannel_controlName )为每个TableLayoutPannel,Pannel,Splitcontainer,Datagridview&所有容器控件。



3.Call SetDoubleBuffered("TableLaoutPannel_controlName") for each TableLayoutPannel,Pannel, Splitcontainer, Datagridview & all container controls.


这篇关于消除因TableLayoutPanel& amp;而导致的闪烁Windows格式的面板......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 09:28