VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > temp > C#教程 >
  • c#实现任意角度旋转图片

制作者:剑锋冷月 单位:无忧统计网,www.51stat.net
 

  以任意角度旋转图像示例。

  实现任意角度旋转图像主要使用Graphics类提供的RotateTransform()方法。代码如下:

privatevoidbutton1_Click(objectsender,EventArgse)
{
  //以任意角度旋转显示图像
  Graphicsg=this.panel1.CreateGraphics();
  floatMyAngle=0;//旋转的角度
  while(MyAngle<360)
  {
    TextureBrushMyBrush=newTextureBrush(MyBitmap);
    this.panel1.Refresh();
    MyBrush.RotateTransform(MyAngle);
    g.FillRectangle(MyBrush,0,0,this.ClientRectangle.Width,this.ClientRectangle.Height);
    MyAngle+=0.5f;
    System.Threading.Thread.Sleep(50);
  }
}



相关教程