日期:2014-05-17  浏览次数:20803 次

winFrom中怎么可以让几个picturebox围绕一个原点转动起来
winFrom中怎么可以让几个picturebox围绕一个原点转动起来

------解决方案--------------------
你自己写个定时器调用就可以了

    public class MoveableObject
    {
        public static PointF Center;
        public Image Image { get; set; }
        public float Speed { get; set; }
        public PointF Location { get; set; }

        private float angle;
        public float Angle
        {
            get { return angle; }
        }
        private float radius;
        public float Radius { get { return radius; } }

        public MoveableObject(Image image, PointF location, float speed)
        {
            this.Image = image;
            this.Location = location;
            this.Speed = speed;

            float dx = location.X + Image.Width / 2 - Center.X;
            float dy = location.Y + Image.Height / 2 - Center.Y;
            radius = (float)Math.Sqrt(dx * dx + dy * dy);
            angle = (float)(Math.Asin(dy / radius) * 180 / Math.PI);
        }

        public void Render(Graphics g)
        {
            g.DrawImage(Image, Location.X + Image.Width / 2, Location.Y + Image.Height / 2);
        }

   &nbs