资源简介
c#图像旋转,加工后可以用来显示进度状态等信息,或者其他需要旋转图像的地方

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace 图像旋转
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender EventArgs e)
{
}
Timer timer1;//定时旋转和移动
Graphics g;//背景图的画图对象
float x = 0;//水平移动的初始位置
Bitmap bmp;
Bitmap background;
private void pictureBox1_Click(object sender EventArgs e)
{
//OpenFileDialog opf = new OpenFileDialog();
//if (opf.ShowDialog() != System.Windows.Forms.DialogResult.OK)
// return;
//bmp = new Bitmap(opf.FileName );
//background = new Bitmap(pictureBox1.Width pictureBox1.Height System.Drawing.Imaging.PixelFormat.Format24bppRgb);//画在PictureBox上
//g = Graphics.FromImage(background);
//g.TranslateTransform(background.Width / 2 background.Height / 2);//移动一下中心点,画在背景的中央,好看些
//timer1 = new Timer();
//timer1.Interval = 100;
//timer1.Tick += new EventHandler(timer1_Tick);
//timer1.Enabled = true;
}
void timer1_Tick(object sender EventArgs e)
{
g.Clear(Color.Black);
g.RotateTransform(10.0F);//每次旋转10度,实际上是画图坐标旋转
g.DrawImage(bmp -bmp.Width / 2 -bmp.Height / 2);//源图中心点和画图对象中心重合,自旋转效果,否则会以左上角为中心旋转
Graphics gb = pictureBox1.CreateGraphics();
x += 3.0f;//水平移动效果,步长3像素
pictureBox1.Refresh();
}
//任意角度旋转
private void RotateTransformButton_Click(object sender EventArgs e)
{
try
{
//Bitmap a = new Bitmap(pictureBox1.Image);//得到图片框中的图片
//pictureBox1.Image = Rotate(a Convert.ToInt32(textBox1.Text));
//pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
//pictureBox1.Location = panel1.Location;
//pictureBox1.Refresh();//最后刷新图片框
}
catch { }
}
#region 图片旋转函数
///
/// 以逆时针为方向对图像进行旋转
///
/// 位图流
/// 旋转角度[0360](前台给的)
///
public Bitmap Rotate(Bitmap b int angle)
{
angle = angle % 360;
//弧度转换
double radian = angle * Math.PI / 180.0;
double cos = Math.Cos(radian);
double sin = Math.Sin(radian);
//原图的宽和高
int w = b.Width;
int h = b.Height;
int W = (int)(Math.Max(Math.Abs(w * cos - h * sin) Math.Abs(w * cos + h * sin)));
int H =
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 878 2014-08-13 14:07 图像旋转.sln
..A..H. 19456 2014-08-15 18:30 图像旋转.suo
文件 11264 2014-08-13 14:45 图像旋转\bin\Debug\图像旋转.exe
文件 28160 2014-08-13 14:45 图像旋转\bin\Debug\图像旋转.pdb
文件 11600 2014-08-15 10:18 图像旋转\bin\Debug\图像旋转.vshost.exe
文件 490 2012-06-06 02:06 图像旋转\bin\Debug\图像旋转.vshost.exe.manifest
文件 5609 2014-08-13 14:45 图像旋转\Form1.cs
文件 4548 2014-08-13 14:45 图像旋转\Form1.Designer.cs
文件 6011 2014-08-13 14:45 图像旋转\Form1.resx
文件 5420 2014-08-15 10:10 图像旋转\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6417 2014-08-13 14:45 图像旋转\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 813 2014-08-15 10:18 图像旋转\obj\x86\Debug\图像旋转.csproj.FileListAbsolute.txt
文件 975 2014-08-13 14:45 图像旋转\obj\x86\Debug\图像旋转.csproj.GenerateResource.Cache
文件 11264 2014-08-13 14:45 图像旋转\obj\x86\Debug\图像旋转.exe
文件 180 2014-08-13 14:45 图像旋转\obj\x86\Debug\图像旋转.Form1.resources
文件 28160 2014-08-13 14:45 图像旋转\obj\x86\Debug\图像旋转.pdb
文件 180 2014-08-13 14:12 图像旋转\obj\x86\Debug\图像旋转.Properties.Resources.resources
文件 493 2014-08-13 14:07 图像旋转\Program.cs
文件 1356 2014-08-13 14:07 图像旋转\Properties\AssemblyInfo.cs
文件 2876 2014-08-13 14:07 图像旋转\Properties\Resources.Designer.cs
文件 5612 2014-08-13 14:07 图像旋转\Properties\Resources.resx
文件 1099 2014-08-13 14:07 图像旋转\Properties\Settings.Designer.cs
文件 249 2014-08-13 14:07 图像旋转\Properties\Settings.settings
文件 3683 2014-08-13 14:12 图像旋转\图像旋转.csproj
目录 0 2014-08-13 14:07 图像旋转\obj\x86\Debug\TempPE
目录 0 2014-08-15 10:10 图像旋转\obj\x86\Debug
目录 0 2014-08-13 14:12 图像旋转\bin\Debug
目录 0 2014-08-13 14:07 图像旋转\obj\x86
目录 0 2014-08-13 14:07 图像旋转\bin
目录 0 2014-08-13 14:07 图像旋转\obj
............此处省略5个文件信息
相关资源
- C# TIP文件生成和拆解
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
评论
共有 条评论