WEB开发网
开发学院软件开发C语言 C#开发WPF/Silverlight动画及游戏系列教程(Game T... 阅读

C#开发WPF/Silverlight动画及游戏系列教程(Game Tutorial):(四十三)制作游戏主菜单面板及鼠标左右键快捷技能栏

 2010-09-30 21:06:32 来源:WEB开发网   
核心提示: QXIcon的主要构造如下:///<summary>///图标控件///</summary>publicQXIcon(IconTypesiconTypes){InitializeComponent();switch(iconTypes){caseIconTypes.Tra

QXIcon的主要构造如下:

        /// <summary>
        /// 图标控件
        /// </summary>
        public QXIcon(IconTypes iconTypes) {
            InitializeComponent();
            switch (iconTypes) {
                case IconTypes.Transform:
                    this.MouseEnter += delegate { Container.Background = NewSource; };
                    this.MouseLeave += delegate { Container.Background = _BodySource; };
                    break;
                case IconTypes.Highlights:
                    Rectangle mask = new Rectangle() { Visibility = Visibility.Collapsed };
                    Container.Children.Add(mask);
                    this.MouseEnter += delegate {
                        mask.Width = this.Width;
                        mask.Height = this.Height;
                        mask.Fill = NewSource;
                        mask.Visibility = Visibility.Visible;
                    };
                    this.MouseLeave += delegate { mask.Visibility = Visibility.Collapsed; };
                    break;
            }
        }
        Brush _BodySource;
        /// <summary>
        /// 获取或设置图标笔刷
        /// </summary>
        public Brush BodySource {
            get { return _BodySource; }
            set { Container.Background = _BodySource = value; }
        }
 
        /// <summary>
        /// 获取或设置变换后(或蒙板)笔刷
        /// </summary>
        public Brush NewSource { get; set; }

上一页  1 2 3 4 5 6 7  下一页

Tags:开发 WPF Silverlight

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接