コード例 #1
0
 private bool IsCollision(PictureBox b, Raindrop r)
 {
     if (b.Location.X > r.pic.Location.X && b.Location.X + 10 < r.pic.Location.X + r.pic.Width && b.Location.Y - 10 < r.pic.Location.Y)
     {
         return(true);
     }
     return(false);
 }
コード例 #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            Random     random = new Random();
            PictureBox pic    = new PictureBox();

            solid.Color  = colors[random.Next(0, colors.Length)];
            pic.Location = new Point(random.Next(0, Width - 40), 0);
            pic.Size     = new Size(30, 30);
            pic.Paint   += new PaintEventHandler(pictureBox_Paint);
            Controls.Add(pic);
            Raindrop raindrop = new Raindrop(pic, solid.Color);

            raindrops.Add(raindrop);
        }