之前的文章提过窗体的双缓冲机制,但容器的双缓冲却要复杂一点。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace line
{
public class GamePanel:Panel
{
public GamePanel()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
}
}
}
参考文章: http://blog.youkuaiyun.com/HUNTER_HZ/article/details/2454332