如何在 Windows 窗体上显示动画 GIF (c#) [英] How do you show animated GIFs on a Windows Form (c#)

查看:55
本文介绍了如何在 Windows 窗体上显示动画 GIF (c#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单,显示了一个相当长的进程运行时的进度消息.这是对 Web 服务的调用,因此我无法真正有意义地在进度条上显示完整的百分比数字.(我不是特别喜欢进度条的 Marquee 属性)

I have a form showing progress messages as a fairly long process runs. It's a call to a web service so I can't really show a percentage complete figure on a progress bar meaningfully. (I don't particularly like the Marquee property of the progress bar)

我想展示一个动画 GIF,让这个过程有某种活动的感觉(例如文件从一台计算机飞到另一台计算机,如 Windows 复制过程).

I would like to show an animated GIF to give the process the feel of some activity (e.g. files flying from one computer to another like Windows copy process).

你是怎么做到的?

推荐答案

并不难.

  1. 将图片框拖放到您的表单上.
  2. 将 .gif 文件添加为图片框中的图像
  3. 加载时显示图片框.

需要考虑的事项:

  • 禁用图片框将阻止 gif 动画.

动画 gif:

如果您正在寻找动画 gif,您可以生成它们:

If you are looking for animated gifs you can generate them:

AjaxLoad - Ajax 加载 gif 生成器

另一种方法:

另一种我发现效果很好的方法是我在 代码项目

Another way that I have found that works quite well is the async dialog control that I found on the code project

这篇关于如何在 Windows 窗体上显示动画 GIF (c#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆