C# 如何绘制在windows窗体上移动的对象序列

C# 如何绘制在windows窗体上移动的对象序列,c#,C#,我已经在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

我已经在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);