Friday, November 2, 2012

TableLayoutPanel Flickering in WinForms



Now use this tablelayoutpanel instead of default TableLayoutPanel in VS. It will decease the intensity of flickering of controls in tablelayoutpanel.

 public partial class MyTablelayoutPanel : TableLayoutPanel
    {
        public MyTablelayoutPanel()
        {
            InitializeComponent();

// this will reduce flicker
            this.DoubleBuffered = true;

            SetStyle(ControlStyles.AllPaintingInWmPaint |
            ControlStyles.OptimizedDoubleBuffer |
            ControlStyles.UserPaint, true);
                     }

        public NXBTablelayoutPanel(IContainer container)
        {
            container.Add(this);
            InitializeComponent();

// this will reduce flicker
            this.DoubleBuffered = true;
            SetStyle(ControlStyles.AllPaintingInWmPaint |
            ControlStyles.OptimizedDoubleBuffer |
            ControlStyles.UserPaint, true);
        }
    }

No comments:

Post a Comment