Ejemplo n.º 1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     _counter++;
     if (_counter % 2 == 0)
     {
         BallDoc.AddBall(this.Width, this.Height);
     }
     BallDoc.Tick();
     Invalidate(true);
 }
Ejemplo n.º 2
0
 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)
     {
         BallDoc  = new BallDoc();
         Filename = string.Empty;
         Invalidate(true);
     }
     timer1.Start();
 }
Ejemplo n.º 3
0
        private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                BallDoc.Click(e.Location);
            }
            else if (e.Button == MouseButtons.Right)
            {
                BallDoc.AddBomb(e.Location);
            }

            Invalidate(true);
        }
Ejemplo n.º 4
0
 public Form1()
 {
     InitializeComponent();
     this.DoubleBuffered = true;
     doc            = new BallDoc();
     timer          = new Timer();
     timer.Interval = 1000;
     timer.Tick    += new EventHandler(timer_tick);
     timer.Start();
     timer1          = new Timer();
     timer1.Interval = 500;
     timer1.Tick    += new EventHandler(timer1_tick);
     timer1.Start();
 }
Ejemplo n.º 5
0
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.Clear(Color.White);
            BallDoc.Draw(e.Graphics);

            if (Filename != string.Empty)
            {
                this.Text = $"Погоди ги топчињата | {Filename.Substring(Filename.LastIndexOf(@"\") + 1)}";
            }
            else
            {
                this.Text = "Погоди ги топчињата";
            }
        }
Ejemplo n.º 6
0
 public Form1()
 {
     InitializeComponent();
     this.DoubleBuffered = true;
     BallDoc             = new BallDoc();
 }