自定义了一个继承panel的类,但是却不能绘图了
因为,绘图闪烁太厉害了.可以继承panel来消除
using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;namespace 贪吃蛇{ public class PanelNew : Panel { public PanelNew() : base() { SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景. SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲 this.UpdateStyles(); //SetStyle(ControlStyles.UserPaint | ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true); //this.UpdateStyles(); } }}