WPF各种基本控件模版


TextBox样式包括:水印、富文本格式、密码框、只读、搜索、选择文件路径 Button样式:鼠标移上去变色、图标+文字、勾选 Loading样式:仿VS2015的等待动画、原型进度条 Image样式:转动 ComboBox样式:水印、日历、清楚按钮 TreeView样式:仿QQ样式 ListBox样式:单选、多选
资源截图
代码片段和文件信息
//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.ControlsUtil.Controls
     目录           0  2016-04-16 22:18  Util.ControlsUtil.ControlsControl
     文件        4737  2016-04-16 22:18  Util.ControlsUtil.ControlsControlAnimatedGIF.cs
     文件        5153  2016-04-16 22:18  Util.ControlsUtil.ControlsControlBulletCheckBox.xaml
     文件        2366  2016-04-16 22:18  Util.ControlsUtil.ControlsControlBulletCheckBox.xaml.cs
     文件        3315  2016-04-16 22:18  Util.ControlsUtil.ControlsControlBusyBox.xaml
     文件         814  2016-04-16 22:18  Util.ControlsUtil.ControlsControlBusyBox.xaml.cs
     文件        9956  2016-04-16 22:18  Util.ControlsUtil.ControlsControlFButton.xaml
     文件        5609  2016-04-16 22:18  Util.ControlsUtil.ControlsControlFButton.xaml.cs
     文件        1427  2016-04-16 22:18  Util.ControlsUtil.ControlsControlFImage.xaml
     文件        2955  2016-04-16 22:18  Util.ControlsUtil.ControlsControlFImage.xaml.cs
     文件         745  2016-04-16 22:18  Util.ControlsUtil.ControlsControlHighTextBlock.xaml
     文件        3857  2016-04-16 22:18  Util.ControlsUtil.ControlsControlHighTextBlock.xaml.cs
     文件        2498  2016-04-16 22:18  Util.ControlsUtil.ControlsControlMessageBoxX.xaml
     文件        4537  2016-04-16 22:18  Util.ControlsUtil.ControlsControlMessageBoxX.xaml.cs
     文件       15826  2016-04-16 22:18  Util.ControlsUtil.ControlsControlMultiComboBox.xaml
     文件        2285  2016-04-16 22:18  Util.ControlsUtil.ControlsControlMultiComboBox.xaml.cs
     文件        9052  2016-04-16 22:18  Util.ControlsUtil.ControlsControlProgressRing.cs
     文件       21339  2016-04-16 22:18  Util.ControlsUtil.ControlsControlProgressRing.xaml
     目录           0  2016-04-16 22:43  Util.ControlsUtil.ControlsControlThumbnailImage
     文件         252  2016-04-16 22:18  Util.ControlsUtil.ControlsControlThumbnailImageEnumThumbnail.cs
     文件         435  2016-04-16 22:18  Util.ControlsUtil.ControlsControlThumbnailImageIThumbnailProvider.cs
     文件         822  2016-04-16 22:18  Util.ControlsUtil.ControlsControlThumbnailImageImageThumbnailProvider.cs
     文件        6701  2016-04-16 22:43  Util.ControlsUtil.ControlsControlThumbnailImageThumbnailImage.cs
     文件         890  2016-04-16 22:18  Util.ControlsUtil.ControlsControlThumbnailImageThumbnailProviderFactory.cs
     文件        1158  2016-04-16 22:18  Util.ControlsUtil.ControlsControlThumbnailImageVedioThumbnailProvider.cs
     文件        1082  2016-04-16 22:18  Util.ControlsUtil.ControlsControlThumbnailImageWebImageThumbnailProvider.cs
     文件       30493  2016-04-16 22:18  Util.ControlsUtil.ControlsControlVirtualizingWrapPanel.cs
     文件        1727  2015-12-22 15:49  Util.ControlsUtil.ControlsControlWaitingBox.xaml
     文件        1698  2015-12-22 15:49  Util.ControlsUtil.ControlsControlWaitingBox.xaml.cs
............此处省略515个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)