首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

定制控件,得到一个dll,其他solution怎么使用他

2012-02-14 
定制控件,得到一个dll,其他solution如何使用他?usingSystemusingSystem.Collections.GenericusingSystem

定制控件,得到一个dll,其他solution如何使用他?
using   System;
using   System.Collections.Generic;
using   System.ComponentModel;
using   System.Drawing;
using   System.Data;
using   System.Text;
using   System.Windows.Forms;

namespace   Buttonly
{
        public   partial   class   Buttonly   :   System.Windows.Forms.Button
        {
                //私有成员
                Image   _imageMouseFlow;
                Image   _imageMouseDown;
                Image   _imageStandard;
                Image   _imageEnabled;

                //构造函数
                public   Buttonly()
                {
                }

                //属性
                [Category( "Behavior "),
                        Description( "鼠标无效时的图像 "),
                                DefaultValue( " ")]
                public   Image   ImageUnEnabled
                {
                        get
                        {
                                return   _imageEnabled;
                        }
                        set
                        {
                                _imageEnabled   =   value;
                        }
                }
                [Category( "Behavior "),
                        Description( "无鼠标动作时的图像 "),
                                DefaultValue( " ")]
                public   Image   ImageStandard
                {
                        get
                        {
                                return   _imageStandard;
                        }


                        set
                        {
                                _imageStandard   =   value;
                                Image   =   value;
                        }
                }
                [Category( "Behavior "),
                        Description( "鼠标滑过时的图像 "),
                                DefaultValue( " ")]
                public   Image   ImageMouseFlow
                {
                        get
                        {
                                return   _imageMouseFlow;
                        }
                        set
                        {
                                _imageMouseFlow   =   value;
                        }
                }
                [Category( "Behavior "),
                        Description( "按下鼠标时的图像 "),
                                DefaultValue( " ")]
                public   Image   ImageMouseDown
                {
                        get
                        {
                                return   _imageMouseDown;
                        }
                        set
                        {
                                _imageMouseDown   =   value;
                        }
                }
                [Category( "Behavior "),


                        Description( "按钮获取焦点上的黑线框 "),
                                DefaultValue(true)]   //设置不让捕获焦点
                public   bool   Selectable
                {
                        get  
                        {  
                                return   this.GetStyle(System.Windows.Forms.ControlStyles.Selectable);  
                        }
                        set  
                        {  
                                this.SetStyle(System.Windows.Forms.ControlStyles.Selectable,   value);
                        }
                }
                //重写属性
                public   new   bool   Enabled
                {
                        get
                        {
                                return   base.Enabled;
                        }
                        set
                        {
                                if   (value)
                                        this.Image   =   ImageUnEnabled;
                                else
                                        this.Image   =   ImageStandard;
                                base.Enabled   =   value;
                        }
                }
                //重写事件
                protected   override   void   OnMouseEnter(EventArgs   e)
                {
                        if(Enabled)


                                this.Image   =   ImageMouseFlow;
                        base.OnMouseEnter(e);
                }
                protected   override   void   OnMouseLeave(EventArgs   e)
                {
                        if   (Enabled)
                                this.Image   =   ImageStandard;
                        base.OnMouseLeave(e);
                }
                protected   override   void   OnMouseDown(MouseEventArgs   mevent)
                {
                        if   (Enabled   &&   mevent.Button   ==   MouseButtons.Left)
                                this.Image   =   ImageMouseDown;
                        base.OnMouseDown(mevent);
                }
                protected   override   void   OnMouseUp(MouseEventArgs   mevent)
                {
                        if   (Enabled   &&   mevent.Button   ==   MouseButtons.Left)
                                this.Image   =   ImageMouseFlow;
                        base.OnMouseUp(mevent);
                }
        }
}

[解决办法]
我是从工具箱中添加的
其他的方法也可以,什么反射应该能用

热点排行