public Form1() { InitializeComponent(); DoubleBuffered = true; topcinja = new BallDoc(); currentColor = Color.Blue; pause = true; }
private void Form1_MouseClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) { return; } BallDoc.AddBall(e.Location, Color); Invalidate(true); }
private void Form1_Paint(object sender, PaintEventArgs e) { e.Graphics.Clear(Color.White); BallDoc.Draw(e.Graphics); if (Filename != string.Empty) { this.Text = $"Ticking Pies | {Filename.Substring(Filename.LastIndexOf(@"\") + 1)}"; } else { this.Text = "Ticking Pies"; } }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { timer.Stop(); if (MessageBox.Show("Are you sure you want to start a new game?", "Start a new game", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { BallDoc = new BallDoc(); Color = Color.CornflowerBlue; Filename = string.Empty; btnStart.Text = "Старт"; Invalidate(true); } else { if (btnStart.Text == "Стоп") { timer.Start(); } } }
private void timer_Tick(object sender, EventArgs e) { BallDoc.Tick(); Invalidate(true); }
public Form1() { InitializeComponent(); this.DoubleBuffered = true; BallDoc = new BallDoc(); }