【问题标题】:Resize GIF and save animation?调整 GIF 大小并保存动画?
【发布时间】: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


    【解决方案1】:

    您只需将 PictureBox 的 SizeMode 设置为 StretchImage 即可让 PictureBox 为您拉伸图像。

    【讨论】:

      猜你喜欢
      • 2013-08-28
      • 2018-04-18
      • 1970-01-01
      • 2012-03-12
      • 2012-09-07
      • 1970-01-01
      • 1970-01-01
      • 2011-02-23
      • 2012-04-16
      相关资源
      最近更新 更多