吐血啊。。c#显示动态gif。。图层的问题

wkplryss 2010-03-07 02:35:13
用c#,想实现一个手机的地图定位程序。。背景是一张地图,上面显示一个小点用来定位,有点类似于两个图层。。。

我想模仿google map手机版那种风格,定位的那个小点是闪烁着的。。。我用gif图来做,用一个picturebox来显示,问题是那个picturebox根本无法变成真正的透明,会显示一个矩形的范围。另外gif放上去也无法实现动态,变成了固定的一帧。。。

不知道要如何解决啊。。查了好多的资料都没有解决。是不是需要第三方的控件。???
头疼啊。。。
...全文
261 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
悔说话的哑巴 2010-03-07
  • 打赏
  • 举报
回复
重写OnPaint()
wuyq11 2010-03-07
  • 打赏
  • 举报
回复
重写OnPaint()
FileStream fs = new FileStream("C:\\a.gif", FileMode.Open);
Image img = Image.FromStream(fs);
this.pictureBox1.Image = img;
qqzeng-ip 2010-03-07
  • 打赏
  • 举报
回复
public class GifImage
{
private Image gifImage;
private FrameDimension dimension;
private int frameCount;
private int currentFrame = -1;
private bool reverse;
private int step = 1; public GifImage(string path)
{
gifImage = Image.FromFile(path); //initialize
dimension = new FrameDimension(gifImage.FrameDimensionsList[0]); //gets the GUID
frameCount = gifImage.GetFrameCount(dimension); //total frames in the animation
} public bool ReverseAtEnd //whether the gif should play backwards when it reaches the end
{
get { return reverse; }
set { reverse = value; }
} public Image GetNextFrame()
{
currentFrame += step; //if the animation reaches a boundary...
if (currentFrame >= frameCount || currentFrame < 1)
{
if (reverse)
{
step *= -1; //...reverse the count
currentFrame += step; //apply it
}
else
currentFrame = 0; //...or start over
}
return GetFrame(currentFrame);
} public Image GetFrame(int index)
{
gifImage.SelectActiveFrame(dimension, index); //find the frame
return (Image)gifImage.Clone(); //return a copy of it
}
}
mayonglong 2010-03-07
  • 打赏
  • 举报
回复
不太懂 ,学习来了~
BEYOND___ 2010-03-07
  • 打赏
  • 举报
回复
入门级别!进来看看 顶了!
zhouhaiyongc 2010-03-07
  • 打赏
  • 举报
回复
初学中不知道 呵呵 !
wkpl1989 2010-03-07
  • 打赏
  • 举报
回复
但是这个好像不行。。。
FileStream fs = new FileStream("C:\\a.gif", FileMode.Open);
Image img = Image.FromStream(fs);
this.pictureBox1.Image = img;

。。。
手机程序里面的Image没有FromStream()这个方法。。
wkpl1989 2010-03-07
  • 打赏
  • 举报
回复
谢谢大家。。学习了,用OnPaint()确实很方便。。
wkplryss 2010-03-07
  • 打赏
  • 举报
回复
自己顶了。。我初学,严重头疼中。。。
jking1989 2010-03-07
  • 打赏
  • 举报
回复
顶了
都说
重写OnPaint()那就试试吧
JesseSong 2010-03-07
  • 打赏
  • 举报
回复
重写OnPaint() 试试。。
源码直接下载地址: https://pan.quark.cn/s/8ac6a8c064f8 Intellij Idea 12 外部jar包导入操作指南 Intellij Idea 12作为一款功能丰富且被广泛采纳的集成开发环境(IDE),为开发者提供了多种便利的工具以支持快速且高效的软件开发与调试工作。在众多功能中,从外部导入jar包是Intellij Idea 12的一项核心操作,接下来的内容将系统性地阐释如何在Intellij Idea 12环境中执行外部jar包的导入操作。 _步骤一:进入项目结构设置界面_ 启动Intellij Idea 12软件,加载一个既有的项目或新建一个项目,随后通过点击“文件”(File)菜单并从下拉选项中选择“项目结构”(Project Structure),此操作将引导用户进入项目结构配置界面。 _步骤二:执行模块添加流程_ 在呈现的项目结构配置界面中,用户需选择“模块”(Modules)这一选项卡,随后点击界面上的“+”符号,并从弹出的列表中选择“JARs or directories”(jar文件或目录),这一步骤将触发“添加jar或目录”(Add Jar or Directory)的对话框显示。 _步骤三:指定要导入的jar文件_ 在“添加jar或目录”(Add Jar or Directory)的对话框中,用户需要浏览并选中计划导入的jar文件,之后点击“确定”(OK)按钮,以完成jar文件的添加过程至项目中。 _步骤四:验证jar文件的导入状态_ 完成上述步骤后,用户可返回至项目结构配置界面,并在“依赖项”(Dependencies)选项卡下查看到新添加的jar文件,这证明了jar文件已成功被导入至项目中。 _注意事项_...

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧