private void btnEditGrid_Click(object sender, EventArgs e) { if (throad != null) { throad.Suspend(); isStop = true; } string sizeString = gridSizeText.Text; wh = int.Parse(sizeString); iwh = 800 / wh; count = 0; ant = new Ant(iwh / 2, iwh / 2, Direction.UP); arrayInit(); g.Clear(Color.White); drawGrid(); drawLine(); gridPanel.Refresh(); }
public LifeGameWindow() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; //这个是位图的大小,一会画图的范围就是那么大 bm = new Bitmap(801, 801); g = Graphics.FromImage(bm); gridPanel.BackgroundImage = bm; #region 数据初始化 wh = 20; iwh = 800 / wh; count = 0; ant = new Ant(iwh / 2, iwh / 2, Direction.UP); arrayInit(); #endregion drawGrid(); drawLine(); }