2个回答
展开全部
public static Image RotateImage(Image img, float a)
{
Bitmap b = new Bitmap(img.Width, img.Height);
Graphics g = Graphics.FromImage(b);
g.TranslateTransform((float)b.Width / 2, (float)b.Height / 2);
g.RotateTransform(a);
g.TranslateTransform(-(float)b.Width / 2, -(float)b.Height / 2);
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(img, new Point(0, 0));
g.Dispose();
return b;
}
private void button1_Click(object sender, EventArgs e)
{
Image img = Image.FromFile(@"D:\1.jpg");
Timer t = new Timer();
t.Interval = 100;
float cnt = 0;
t.Tick += delegate
{
cnt += 10;
this.pictureBox1.Image = RotateImage(img, cnt);
};
t.Start();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询