C#一道问题,难以解决
小球一开始在与水平线45度夹角的直线上移动,碰到窗体边缘后会反弹。小球碰撞后沿来路反回。中间的过程我不会编写。。感觉思绪理解不清楚while (f.pictureBox3.Location.Y > -1 && f.pictureBox3.Location.Y < 450 && f.pictureBox3.Location.X > -1 && f.pictureBox3.Location.X < 670){
if (f.pictureBox3.Location.Y == 432)
{
for (int i = 0; i < 432; i++)
{
f.pictureBox3.Location = new Point(f.pictureBox3.Location.X + 1, f.pictureBox3.Location.Y - 1);
Thread.Sleep(10);
}
}
if (f.pictureBox3.Location.Y == 0)
{
for (int i = 0; i < 432; i++)
{
f.pictureBox3.Location = new Point(f.pictureBox3.Location.X + 1, f.pictureBox3.Location.Y + 1);
Thread.Sleep(10);
}
}
if (f.pictureBox2.Location.X == 650)
{
for (int i = 0; i < 650; i++)
{
f.pictureBox3.Location = new Point(f.pictureBox3.Location.X - 1, f.pictureBox3.Location.Y + 1);
Thread.Sleep(10);
}
}
if (f.pictureBox3.Location.X == 0)
{
for (int i = 0; i < 650; i++)
{
f.pictureBox3.Location = new Point(f.pictureBox3.Location.X + 1, f.pictureBox3.Location.Y + 1);
Thread.Sleep(10);
}
}
if (f.pictureBox3.Location.Y > 0 && f.pictureBox3.Location.Y < 432 && f.pictureBox3.Location.X ==0 && f.pictureBox3.Location.X < 650)
{
for (int i = f.pictureBox3.Location.Y; i <432;++i)
{
f.pictureBox3.Location = new Point(f.pictureBox3.Location.X -1, f.pictureBox3.Location.Y + 1);
Thread.Sleep(10);
}
}
}
这是我编写的一部分,感觉不是很对求大神解答啊