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);
[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);
相关文章推荐
- csharp: using wininet.dll
- c#语言报表和图表。
- 初探C#的打印功能
- C# 深入浅出 委托与事件
- C# PropertyGrid控件应用心得
- AE+C#开发问题实录(一)每用户订阅上的所有人 SID 不存在
- 如何使用C#加密解密XML文档
- C#中datagridview的EditingControlShowing事件用法实例
- C#处理datagridview虚拟模式的方法
- C# WinForm程序退出的方法
- C#中计算时间差
- C# Winfrom開機自動啟動
- C# 加密解密
- C#中的里氏替换原则
- C#操作Office.word(一)
- C#学习笔记一(数据类型,转义字符)
- C#的Sockets用法
- 用c#写的一个局域网聊天客户端 类似小飞鸽
- C# this.Hide()
- C#实现MD5加密