Esempio n. 1
0
        private void RefreshImageSource()
        {
            if (this.Image != null)
            {
                ImageAnimatiorExpender.UpdateFrames(this.Image);
                ImageSource imageSource = ImageAnimatiorExpender.GetImageSource(this.Image);

                if (imageSource == null)
                {
                    IntPtr ip = (this.Image as System.Drawing.Bitmap).GetHbitmap();
                    imageSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
                        ip, IntPtr.Zero, System.Windows.Int32Rect.Empty,
                        System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
                }

                this.Source = imageSource;
            }
        }
Esempio n. 2
0
 private void Animate(bool animate, System.Drawing.Image image)
 {
     if (animate != this.currentlyAnimating)
     {
         if (animate)
         {
             if (image != null)
             {
                 ImageAnimatiorExpender.Animate(image, new EventHandler(this.OnFrameChanged));
                 this.currentlyAnimating = animate;
             }
         }
         else
         {
             if (image != null)
             {
                 ImageAnimatiorExpender.StopAnimate(image, new EventHandler(this.OnFrameChanged));
                 this.currentlyAnimating = animate;
             }
         }
     }
 }