using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
PictureBox []pic=new PictureBox[4];
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
}
private void Form1_Load(object sender, EventArgs e)
{
pic[0] = pictureBox1;
pic[1] = pictureBox2;
pic[2] = pictureBox3;
pic[3] = pictureBox4;
}
private void timer1_Tick(object sender, EventArgs e)
{
Random rd = new Random();
for (int i = 0; i < 4; i++)
{
int h = rd.Next(10);
pic[i].Location = new Point(pic[i].Location.X-5,pic[i].Location.Y-5+h);
}
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Stop();
}
int count = 0;
void pic_Click(object sender, EventArgs e)
{
PictureBox p = (PictureBox)sender;
p.Visible = false;
count++;
if (count == pic.Length)
{ MessageBox.Show("win "); }
}
private void pictureBox2_Click(object sender, EventArgs e)
{
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
}
}
}