C# Winform关于控件TabControl闪烁的问题

自己重写了一个Form,然后再该form上放一个TabControl鼠标移上去会闪烁,经过网上查找解决方案,最后总算是解决了....下面附上代码:

重写一个TabControl代码如下:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Windows.Forms;



namespace MQXS.Forms

{

    public  class NewTabControl : TabControl

    {

        /// <summary>

        /// 

        /// </summary>

        public NewTabControl()

        {

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

        }

        /// <summary>

        /// 

        /// </summary>

        protected override CreateParams CreateParams

        {

            get

            {

                CreateParams cp = base.CreateParams;

                cp.ExStyle |= 0x02000000;

                return cp;

            }

        }

    }

}
View Code

 

 

你可能感兴趣的:(WinForm)