예제 #1
0
        private static void OnUriChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            GifControl gif = d as GifControl;
            String     u   = e.NewValue.ToString();

            gif.Uri = u;
        }
예제 #2
0
        static void ChangingFrameIndex(DependencyObject obj, DependencyPropertyChangedEventArgs ev)
        {
            GifControl ob = obj as GifControl;


            ob.gifImg.SelectActiveFrame(ob.dimension, (int)ev.NewValue);

            BitmapImage bi = new BitmapImage();

            bi.BeginInit();
            MemoryStream ms = new MemoryStream();

            // Save to a memory stream..
            ob.gifImg.Save(ms, ImageFormat.Bmp);
            // Rewind the stream..
            ms.Seek(0, SeekOrigin.Begin);
            // Tell the WPF image to use this stream...
            bi.StreamSource = ms;
            bi.EndInit();


            ob.Source = bi;
            ob.InvalidateVisual();
        }