比如定义一个圆圈,让一个pictruebox在圆圈上循环移动。

解决方案 »

  1.   

    private void 圆心运动(Point 圆心坐标, double 转速, int 半径,
        ref double 角度, out Point 物体坐标)
    {
        角度 = 角度 + 转速;
        if (角度 > 2 * Math.PI)
            角度 = 角度 - 2 * Math.PI;
        else if (角度 < 0)
            角度 = 角度 + 2 * Math.PI;
        物体坐标 = new Point(
           (int)(Math.Cos(角度) * 半径) + 圆心坐标.X,
           (int)(Math.Sin(角度) * 半径) + 圆心坐标.Y
        );
    }
    private double 角度 = 0;
    private void timer1_Tick(object sender, EventArgs e)
    {
        Point 物体坐标;
        圆心运动(new Point(100, 100), 0.3, 90, ref 角度, out 物体坐标);
        pictureBox1.Left = 物体坐标.X;
        pictureBox1.Top = 物体坐标.Y;    // 可以一个绕一个,这里就不写了
    }private void Form1_Load(object sender, EventArgs e)
    {
        timer1_Tick(sender, e);
        timer1.Enabled = true;
    }
      

  2.   

    谢谢 zswang(伴水清清)(专家门诊清洁工) 您的方法很有启发性,我一直忘记考虑了速度问题!!