消除因TableLayoutPanel& amp;而导致的闪烁Windows格式的面板...... [英] Remove flickering due to TableLayoutPanel & Panel in windows form ...

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

问题描述

这是我的问题&我也回答

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

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

推荐答案

完全消除因TableLayoutPanel& amp;而导致的闪烁Windows窗体中的面板如下:= -

1.设置Form = true的双缓冲属性。

2.在form.cs中粘贴以下2个函数



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



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


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

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆