| 发表于:2007-01-04 15:34:542楼 得分:0 |
using system; using system.componentmodel; using system.collections; using system.diagnostics; using system.windows.forms; using system.drawing; using system.drawing.drawing2d; namespace bensoftcn.winforms.ui { [toolboxitem(true)] public class textboxxp : system.windows.forms.textbox { /// <summary> /// 获得当前进程,以便重绘控件 /// </summary> /// <param name= "hwnd "> </param> /// <returns> </returns> [system.runtime.interopservices.dllimport( "user32.dll ")] static extern intptr getwindowdc(intptr hwnd); [system.runtime.interopservices.dllimport( "user32.dll ")] static extern int releasedc(intptr hwnd, intptr hdc); /// <summary> /// 是否启用热点效果 /// </summary> private bool _hottrack = true ; /// <summary> /// 边框颜色 /// </summary> private color _bordercolor = color.fromargb(0xa7,0xa6,0xaa); /// <summary> /// 热点边框颜色 /// </summary> private color _hotcolor = color.fromargb(0x33,0x5e,0xa8); /// <summary> /// 是否鼠标mouseover状态 /// </summary> private bool _ismouseover = false ; #region 属性 /// <summary> /// 是否启用热点效果 /// </summary> [ category( "行为 "), description( "获得或设置一个值,指示当鼠标经过控件时控件边框是否发生变化。只在控件的borderstyle为fixedsingle时有效 "), defaultvalue(true)] public bool hottrack { get { return this._hottrack ; } set { this._hottrack = value ; //在该值发生变化时重绘控件,下同 //在设计模式下,更改该属性时,如果不调用该语句, //则不能立即看到设计试图中该控件相应的变化 this.invalidate(); } } /// <summary> /// 边框颜色 /// </summary> [ category( "外观 "), description( "获得或设置控件的边框颜色 "), defaultvalue(typeof(color), "#a7a6aa ")] public color bordercolor { get { return this._bordercolor; } set { this._bordercolor = value; this.invalidate(); } } /// <summary> /// 热点时边框颜色 /// </summary> [ category( "外观 "), description( "获得或设置当鼠标经过控件时控件的边框颜色。只在控件的borderstyle为fixedsingle时有效 "), defaultvalue(typeof(color), "#335ea8 ")] public color hotcolor { get { return this._hotcolor; } set { this._hotcolor = value; this.invalidate(); } } #endregion 属性 /// <summary> /// /// </summary> public textboxxp():base() { } | | |
|