private void timer1_Tick(object sender, EventArgs e) { int top = menuStrip1.Height + toolStrip1.Height; int heigth = this.Height - statusStrip1.Height - 25; BaloonsDoc.MoveBaloons(top, heigth); Invalidate(); }
public Form1() { InitializeComponent(); BaloonsDoc = new BaloonsDoc(); Color = Color.DarkRed; Filename = string.Empty; Random = new Random(); this.DoubleBuffered = true; timer1.Start(); }
private void toolStripButton1_Click(object sender, EventArgs e) { int x = Random.Next(Baloon.Radius * 2, this.Width - Baloon.Radius * 2); int y = Random.Next(Baloon.Radius * 2 + toolStrip1.Height + menuStrip1.Height, this.Height - Baloon.Radius * 2 - statusStrip1.Height - 25); Point center = new Point(x, y); BaloonsDoc.AddBaloon(center, Color); Invalidate(true); }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { timer1.Stop(); if (MessageBox.Show("Are you sure you want to start a new game", "Start a new game", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { BaloonsDoc = new BaloonsDoc(); Filename = string.Empty; Invalidate(true); } timer1.Start(); }
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e) { if (selectAllToolStripMenuItem.Text == "Select &All") { BaloonsDoc.SelectAllBaloons(true); selectAllToolStripMenuItem.Text = "Unselect &All"; } else { BaloonsDoc.SelectAllBaloons(false); selectAllToolStripMenuItem.Text = "Select &All"; } Invalidate(); }
private void Form1_Paint(object sender, PaintEventArgs e) { e.Graphics.Clear(Color.White); BaloonsDoc.DrawBaloons(e.Graphics); if (Filename != string.Empty) { this.Text = $"Moving baloons | {Filename.Substring(Filename.LastIndexOf(@"\") + 1)}"; } else { this.Text = "Moving baloons"; } }
private void Form1_MouseClick(object sender, MouseEventArgs e) { BaloonsDoc.SelectBaloon(e.X, e.Y); }
private void statusStrip1_Paint(object sender, PaintEventArgs e) { lblBaloni.Text = $"Baloons: {BaloonsDoc.BallonsCount()}"; }