private void Tmr_Tick(object sender, EventArgs e) { c++; if (c == 10) { Tmr.Stop(); Notif.ShowBalloonTip(1200); } }
public void StopTrack() { if (Tmr == null) { return; } Tmr.Dispose(); Tmr = null; Counter = 0; }
private void startToolStripMenuItem_Click(object sender, EventArgs e) { Tmr.Start(); gamedo = true; pauseToolStripMenuItem.Enabled = true; stopToolStripMenuItem.Enabled = true; this.FormBorderStyle = FormBorderStyle.FixedSingle; Graphics g = FieldPnl.CreateGraphics(); fruit = NewFruit(); g.FillEllipse(brushFruit, fruit.X * 10, fruit.Y * 10, 10, 10); TSSL1.Text = $"Score: {score}"; if (GameOverLbl.Visible) { GameOverLbl.Visible = false; PAKTCLbl.Visible = false; PEOETELbl.Visible = false; } startToolStripMenuItem.Enabled = false; difficultyToolStripMenuItem.Enabled = false; }
private void pauseToolStripMenuItem_Click(object sender, EventArgs e) { if (gamedo) { if (pause) { pause = false; Tmr.Start(); startToolStripMenuItem.Enabled = false; stopToolStripMenuItem.Enabled = true; pauseToolStripMenuItem.Text = "Pause"; } else { pause = true; Tmr.Stop(); startToolStripMenuItem.Enabled = false; stopToolStripMenuItem.Enabled = false; pauseToolStripMenuItem.Text = "Continue"; } } }
private void stopToolStripMenuItem_Click(object sender, EventArgs e) { Tmr.Stop(); gamedo = false; FormBorderStyle = FormBorderStyle.Sizable; moves = 0; score = 0; KeyWay = Way.None; wid = FieldPnl.Width / 10.0; hei = FieldPnl.Height / 10.0; widInt = (int)Math.Truncate(wid); heiInt = (int)Math.Truncate(hei); SnakeBody.Clear(); SnakeBody = new List <Point>() { new Point(widInt / 2, heiInt / 2), new Point(widInt / 2, heiInt / 2), new Point(widInt / 2, heiInt / 2), new Point(widInt / 2, heiInt / 2) }; FieldPnl.Refresh(); stopToolStripMenuItem.Enabled = false; startToolStripMenuItem.Enabled = true; pauseToolStripMenuItem.Enabled = false; difficultyToolStripMenuItem.Enabled = true; }
private void btnPress_Click(object sender, EventArgs e) { Tmr.Start(); c = 0; }