totaliheart.blogg.se

Animated gif background images
Animated gif background images








It’s a rather “clean” approach, but it forces you to use a specific control for GIF images. Some solutions take advantage of the ImageAnimator class from System.Drawing (GDI), others use a WPF animation to change the current frame. Create a custom control that inherits Image and handles the animation.Use the PictureBox control from Windows Forms, via a WindowsFormsHost: I personnally dislike using WinForms controls in WPF, it really looks like a hack….Furthermore, transparency for GIF images isn’t supported in MediaElement, which makes the final result quite ugly Use the MediaElement control: unfortunately this control only supports URI like file:// or not the pack:// URI schema used for WPF resources this means the image can’t be included in the resources, it has to be in a separate file.Many solutions to this problem have been proposed on technical forums and blogs, usually variations of the following approaches: Actually, the GIF format itself is supported by the imaging API, but the Image control only shows the first frame of the animation. WPF is a great technology, but sometimes it seems to be missing some really basic features… A frequently mentioned example is the lack of support for animated GIF images. Note: The code in this article is out of date the current code is hosted on GitHub.










Animated gif background images