wpf显示GIF


第三方控件
用浏览器控件
HOST WINFORM的PICTUREBOX
用MEDIAELEMENT
读取GIF文件自己解码显示
调用解码类一个图片一个图片解析出来定时器
//Create a Bitmpap Object.
    Bitmap animatedImage = new Bitmap(“SampleAnimation.gif”);
    bool currentlyAnimating = false;
                    
    //This method begins the animation.
    public void AnimateImage()
    {
        if (!currentlyAnimating)
        {
                    
            //Begin the animation only once.
            ImageAnimator.Animate(animatedImage, new EventHandler(this.OnFrameChanged));
            currentlyAnimating = true;
        }
    }


    private void OnFrameChanged(object o, EventArgs e)
    {
                    
        //Force a call to the Paint event handler.
        this.Invalidate();
    }


    protected override void OnPaint(PaintEventArgs e)
    {
                    
        //Begin the animation.
        AnimateImage();
                    
        //Get the next frame ready for rendering.
        ImageAnimator.UpdateFrames();
                    
        //Draw the next frame in the animation.
        e.Graphics.DrawImage(this.animatedImage, new Point(0, 0));
    }


    public static void Main()
    {
        Application.Run(new animateImage());
    }



.Victor’s BLOG: GIF文件格式详解
http://blog.zhongmoo.cn/2009/05/gif.html



WPF中不支持gif的问题 — Windows Live
http://kimiya25.spaces.live.com/Blog/cns!27A083D4FD9435E9!1308.entry



Disabled Images in WPF – Andrew Smith – Infragistics Community
http://blogs.infragistics.com/blogs/andrew_smith/archive/2008/03/30/disabled-images-in-wpf.aspx



GifBitmapDecoder 类 (System.Windows.Media.Imaging)
http://msdn.microsoft.com/zh-cn/library/system.windows.media.imaging.gifbitmapdecoder.aspx
Stream imageStreamSource = new FileStream(“tulipfarm.gif”, FileMode.Open, FileAccess.Read, FileShare.Read); GifBitmapDecoder decoder = new GifBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);


ImageAnimator.Animate 方法 (System.Drawing)
http://msdn.microsoft.com/zh-tw/library/system.drawing.imageanimator.animate(VS.80).aspx



怎样让我的动画真真的动起来?
http://social.msdn.microsoft.com/forums/zh-TW/232/thread/5ac14de8-c2e1-4076-932a-e9de4b0cebf5/



My animated .gif control for WPF – Pragmatic TSQL Programmer
http://www.solidrockstable.com/blogs/PragmaticTSQL/Lists/Posts/Post.aspx?ID=37



How do I get an animated gif to work in WPF? – Stack Overflow
http://stackoverflow.com/questions/210922/how-do-i-get-an-animated-gif-to-work-in-wpf



Creating Animated GIF files in WPF
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/6ef358a7-d1ac-4267-91d9-166024aad8ca



CodeProject: Another approach to animated GIF in WPF, with transparency. Free source code and programming help
http://www.codeproject.com/KB/WPF/animatedgifinwpf.aspx



CodeProject: GIF animation in WPF. Free source code and programming help
http://www.codeproject.com/KB/WPF/wpfgifanimator.aspx



[WPF疑难]在WPF中显示动态GIF – this.Study(DateTime.Now) – 博客园
http://www.cnblogs.com/zhouyinhui/archive/2007/12/23/1011555.html



WPF support gif — Windows Live
http://kimiya25.spaces.live.com/Blog/cns!27A083D4FD9435E9!1311.entry



[WPF疑难]在WPF中显示动态GIF_软件_科技时代_新浪网
http://tech.sina.com.cn/s/s/2008-05-20/0751665803.shtml



当WPF遇到了gif_福娃居
http://hi.baidu.com/mych/blog/item/1eb14f545f12a752564e00be.html



How do I get an animated gif to work in WPF? – Stack Overflow
http://stackoverflow.com/questions/210922/how-do-i-get-an-animated-gif-to-work-in-wpf



用C#的winform显示gif动画 – 软件使用 – 欢迎来到海青论坛 – Powered by Discuz!
http://youth.dlmu.edu.cn/bbs/viewthread.php?tid=29151



 

历史博文

标签:,
九月 19, 2009 at 12:59 上午 by yippee 72 次
Category: Dev
Tags: ,