【发布时间】:2011-11-01 05:00:35
【问题描述】:
我正在使用我编写的这段代码来调整图像大小以适合我的 PictureBox:
//Creates a new Bitmap as the size of the window
Bitmap bmp = new Bitmap(this.Width, this.Height);
//Creates a new graphics to handle the image that is coming from the stream
Graphics g = Graphics.FromImage((Image)bmp);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
//Resizes the image from the stream to fit our windows
g.DrawImage(Properties.Resources.loading, 0, 0, this.Width, this.Height);
this.Image = (Image)bmp;
完美运行!
唯一的问题是当我尝试调整 GIF 的大小时......它会调整大小但我失去了动画......
有什么解决办法吗?
【问题讨论】:
标签: c# .net graphics picturebox animated-gif