1 .公共方法
公共类mytextbox : textbox
{ protectedoverridevoidonenabledchanged (eventargs e )
{base.onenabledchanged(e; 启用为False时设置if(this.enabled )
{ this .SetStyle (深荔枝,false );
} else this .SetStyle (深荔枝,true ); 重新绘制this .Invalidate (;
//绘制textboxprotectedoverridevoidonpaint (painteventargse )
{base.onpaint(e;
system.drawing.brushb=new system.drawing.solid brush (this.forecolor );
string格式SF=new string格式(;
SF.line alignment=string alignment.center;
SF.alignment=string alignment.center; //绘制字符串//e.graphics.drawstring (this.text,this.Font,b,- 1,1 ); e.graphics.drawstring (this.text,this .Font,b,积极的飞机,sf );
b.Dispose (;
}
} 2.页面designer.cs已更改为MyTextBox