首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >调整GIF大小并保存动画?

调整GIF大小并保存动画?
EN

Stack Overflow用户
提问于 2011-08-22 22:18:02
回答 1查看 2.2K关注 0票数 2

我正在使用我编写的代码来调整我的图像大小以适应我的PictureBox:

代码语言:javascript
运行
复制
//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的大小时…它可以调整大小,但我失去了动画效果...

有什么办法解决这个问题吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-08-22 22:21:20

您只需将图片框的SizeMode设置为StretchImage,即可使PictureBox为您拉伸图像。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7148868

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档