我目前正在绘制一条线到一个表单,然后让那条线在屏幕上移动,也在旋转,作为一个新手程序员,我不知道该如何去做。任何提示或建议将不胜感激。
感谢。
编辑:添加了绘制线条的代码,我知道非常简单
public void DrawStick()
{
for (int timer = 0; timer < 10; timer++)
{
int randnum = rand.Next(-10, 10);
int startX = startPoint.X + randnum;
int startY = startPoint.Y + randnum;
int endX = (int)(startPoint.X + 20 * Math.Cos((double)slope * Math.PI / 180));
int endY = (int)(startPoint.Y + 20 * Math.Sin((double)slope * Math.PI / 180));
endPoint = new Point(endX, endY);
startPoint = new Point(startX, startY);
slope = (startPoint.Y - endPoint.Y) / (startPoint.X - endPoint.X);
graObject.DrawLine(myPen, startPoint, endPoint);
Thread.Sleep(100);
graObject.DrawLine(backgroundPen, startPoint, endPoint);
}
}
startPoint和endPoint在此方法之外生成一次。