笔仙2下载,戚凡科,将乐
public sealed class mycustomtextbox:textbox
{
private const int wm_paint = 0x000f;
private string _txtplaceholder="";
[category("自定义属性"), description("文本框里的提示文字"), defaultvalue("请在此输入"), browsable(true)]
public string txtplaceholder
{
get { return _txtplaceholder; }
set {
if (value == null) throw new argumentnullexception("value");
_txtplaceholder = value;
this.invalidate();
}
}
protected override void wndproc(ref message m)
{
base.wndproc(ref m);
if (m.msg == wm_paint && !this.focused && (this.textlength == 0) && (_txtplaceholder.length > 0))
{
textformatflags tff = (textformatflags.endellipsis |
textformatflags.noprefix |
textformatflags.left |
textformatflags.top | textformatflags.nopadding);
using (graphics g = this.creategraphics())
{
rectangle rect = this.clientrectangle;
rect.offset(4, 1);
textrenderer.drawtext(g, _txtplaceholder, this.font, rect, systemcolors.graytext, tff);
}
}
}
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论