1

我在 c# 中创建了在表单中水平移动的对象。现在我必须绘制多个(不是我以前做过的一个对象)随机生成并在表单中按顺序移动的对象。

这是我移动对象的代码

private Rectangle Enemy1 = new Rectangle(0, 150, 40, 40);

//code below paints the object on the form
e.Graphics.DrawRectangle(Pens.Red, Enemy1);

//part below moves the object on the form
int EX1 = Enemy1.Location.X;
int EY1 = Enemy1.Location.Y;
Enemy1.Location = new Point(EX1 += 10, EY1 += 0);
4

0 回答 0