• 大小: 4.89MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-13
  • 语言: C#
  • 标签:

资源简介

WPF.Util.Controls全套自定义样式 。

资源截图

代码片段和文件信息

//source( Microsoft All-In-One Code framework ):http://1code.codeplex.com/
using System;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using File = System.Utility.Helper.File;
using Image = System.Windows.Controls.Image;

namespace Util.Controls
{
    /// 
    /// 支持GIF动画图片播放的图片控件,GIF图片源GIFSource
    /// 

    public class AnimatedGIF : Image
    {
        public static readonly DependencyProperty GIFSourceProperty = DependencyProperty.Register(
            “GIFSource“ typeof(string) typeof(AnimatedGIF) new Propertymetadata(OnSourcePropertyChanged));

        /// 
        /// GIF图片源,支持相对路径、绝对路径
        /// 

        public string GIFSource
        {
            get { return (string)GetValue(GIFSourceProperty); }
            set { SetValue(GIFSourceProperty value); }
        }

        internal Bitmap Bitmap; // Local bitmap member to cache image resource
        internal BitmapSource BitmapSource;
        public delegate void frameUpdatedEventHandler();

        /// 
        /// Delete local bitmap resource
        /// Reference: http://msdn.microsoft.com/en-us/library/dd183539(VS.85).aspx
        /// 

        [DllImport(“gdi32.dll“ CharSet = CharSet.Auto SetLastError = true)]
        static extern bool Deleteobject(IntPtr hobject);

        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);
            this.Loaded += AnimatedGIF_Loaded;
            this.Unloaded += AnimatedGIF_Unloaded;
        }

        void AnimatedGIF_Unloaded(object sender RoutedEventArgs e)
        {
            this.StopAnimate();
        }

        void AnimatedGIF_Loaded(object sender RoutedEventArgs e)
        {
            BindSource(this);
        }

        /// 
        /// Start animation
        /// 

        public void StartAnimate()
        {
            ImageAnimator.Animate(Bitmap OnframeChanged);
        }

        /// 
        /// Stop animation
        /// 

        public void StopAnimate()
        {
            ImageAnimator.StopAnimate(Bitmap OnframeChanged);
        }

        /// 
        /// Event handler for the frame changed
        /// 

        private void OnframeChanged(object sender EventArgs e)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Normal
                                   new frameUpdatedEventHandler(frameUpdatedCallback));
        }

        private void frameUpdatedCallback()
        {
            ImageAnimator.Updateframes();

            if (BitmapSource != null)
                BitmapSource.Freeze();

            // Convert the bitmap to BitmapSource that can be display in WPF Visua

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-04-16 22:24  Util.Controls\
     目录           0  2016-04-16 22:43  Util.Controls\Util.Controls\
     目录           0  2016-04-16 22:18  Util.Controls\Util.Controls\Control\
     文件        4737  2016-04-16 22:18  Util.Controls\Util.Controls\Control\AnimatedGIF.cs
     文件        5153  2016-04-16 22:18  Util.Controls\Util.Controls\Control\BulletCheckBox.xaml
     文件        2366  2016-04-16 22:18  Util.Controls\Util.Controls\Control\BulletCheckBox.xaml.cs
     文件        3315  2016-04-16 22:18  Util.Controls\Util.Controls\Control\BusyBox.xaml
     文件         814  2016-04-16 22:18  Util.Controls\Util.Controls\Control\BusyBox.xaml.cs
     文件        9956  2016-04-16 22:18  Util.Controls\Util.Controls\Control\FButton.xaml
     文件        5609  2016-04-16 22:18  Util.Controls\Util.Controls\Control\FButton.xaml.cs
     文件        1427  2016-04-16 22:18  Util.Controls\Util.Controls\Control\FImage.xaml
     文件        2955  2016-04-16 22:18  Util.Controls\Util.Controls\Control\FImage.xaml.cs
     文件         745  2016-04-16 22:18  Util.Controls\Util.Controls\Control\HighTextBlock.xaml
     文件        3857  2016-04-16 22:18  Util.Controls\Util.Controls\Control\HighTextBlock.xaml.cs
     文件        2498  2016-04-16 22:18  Util.Controls\Util.Controls\Control\MessageBoxX.xaml
     文件        4537  2016-04-16 22:18  Util.Controls\Util.Controls\Control\MessageBoxX.xaml.cs
     文件       15826  2016-04-16 22:18  Util.Controls\Util.Controls\Control\MultiComboBox.xaml
     文件        2285  2016-04-16 22:18  Util.Controls\Util.Controls\Control\MultiComboBox.xaml.cs
     文件        9052  2016-04-16 22:18  Util.Controls\Util.Controls\Control\ProgressRing.cs
     文件       21339  2016-04-16 22:18  Util.Controls\Util.Controls\Control\ProgressRing.xaml
     目录           0  2016-04-16 22:43  Util.Controls\Util.Controls\Control\ThumbnailImage\
     文件         252  2016-04-16 22:18  Util.Controls\Util.Controls\Control\ThumbnailImage\EnumThumbnail.cs
     文件         435  2016-04-16 22:18  Util.Controls\Util.Controls\Control\ThumbnailImage\IThumbnailProvider.cs
     文件         822  2016-04-16 22:18  Util.Controls\Util.Controls\Control\ThumbnailImage\ImageThumbnailProvider.cs
     文件        6701  2016-04-16 22:43  Util.Controls\Util.Controls\Control\ThumbnailImage\ThumbnailImage.cs
     文件         890  2016-04-16 22:18  Util.Controls\Util.Controls\Control\ThumbnailImage\ThumbnailProviderFactory.cs
     文件        1158  2016-04-16 22:18  Util.Controls\Util.Controls\Control\ThumbnailImage\VedioThumbnailProvider.cs
     文件        1082  2016-04-16 22:18  Util.Controls\Util.Controls\Control\ThumbnailImage\WebImageThumbnailProvider.cs
     文件       30493  2016-04-16 22:18  Util.Controls\Util.Controls\Control\VirtualizingWrapPanel.cs
     文件        1727  2015-12-22 15:49  Util.Controls\Util.Controls\Control\WaitingBox.xaml
     文件        1698  2015-12-22 15:49  Util.Controls\Util.Controls\Control\WaitingBox.xaml.cs
............此处省略516个文件信息

评论

共有 条评论