首页  编辑  

让控件做圆周运动

Tags: /C#/算法/   Date Created:

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 . Width / 2 ;

   pictureBox1 . Top = . Y - pictureBox1 . Height / 2 ;

}

private void Form1_Load( object sender , EventArgs e)

{

   timer1_Tick(sender, e);

   timer1 . Enabled = true;

}