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

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

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

不知道要如何解决啊。。查了好多的资料都没有解决。是不是需要第三方的控件。???
头疼啊。。。
...全文
213 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() 试试。。

110,539

社区成员

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

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

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