您的位置:首页 > 编程语言 > C#

C#实现任意角度旋转图片(方法1)

2015-06-24 13:00 627 查看
实现任意角度旋转图像主要使用Graphics类提供的RotateTransform()方法。代码如下:

[b][c-sharp] view
plaincopy[/b]

private void button1_Click(objectsender,EventArgse)

{

  //以任意角度旋转显示图像

  Graphics g=this.panel1.CreateGraphics();

  float MyAngle=0;//旋转的角度

  while(MyAngle<360)

  {

    TextureBrush MyBrush=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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: