在winUserCtr下这样:
[DefaultValue(ScaleSizeStyle.Null)]
[Browsable(true)]
[Category("Layout")]
public virtual ScaleSizeStyle ScaleSize
{
get
{
return scaleSize;
}
set
{
scaleSize = value;
}
}
试试!
[DefaultValue(ScaleSizeStyle.Null)]
[Browsable(true)]
[Category("Layout")]
public virtual ScaleSizeStyle ScaleSize
{
get
{
return scaleSize;
}
set
{
scaleSize = value;
}
}
试试!
private bool chborNo;
[Bindable(true),
Category("表格"),
DefaultValue("false")]
public bool ChborNo
{
get
{
return chborNo;
} set
{
chborNo = value;
}
}
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Data.OleDb;
using System.Web.UI;
using System.Web.UI.WebControls;namespace DDLLY.WebControls
{
/// <summary>
/// DDLTextBox 的摘要说明。
/// </summary>
///
[ToolboxDataAttribute("<{0}:DDLTextBox runat=server></{0}:DDLTextBox>")]
[DefaultPropertyAttribute("Text")]
[DescriptionAttribute("DDLTextBox")]
public class DDLTextBox:TextBox
{
public DDLTextBox()
{
//
// TODO: 在此处添加构造函数逻辑
//
} private Color _hcolor;
[CategoryAttribute("Appearance")]
[BindableAttribute(true)]
[TypeConverterAttribute(typeof(System.Web.UI.WebControls.WebColorConverter))]
[DescriptionAttribute("设置选中时高亮的颜色")]
public Color HColor
{
get
{
return _hcolor;
} set
{
_hcolor = value;
}
} public Color MyColor
{
get
{
return _hcolor;
} set
{
_hcolor = value;
}
} private string _appVer="1.0"; [CategoryAttribute("自定义编辑器"), DefaultValueAttribute("1.0"), DescriptionAttribute("版本信息"), ReadOnlyAttribute(true), BrowsableAttribute(true)] public string AppVer { get {return this._appVer;} set {this._appVer=value;} }
protected override void Render(HtmlTextWriter writer)
{
if (!(_hcolor == Color.Empty))
{
this.Attributes.Add("onfocus", String.Concat("javascript:this.style[\'background\']=\'", _hcolor.Name.Replace("ff","#"), "\'"));
if (this.BackColor!= Color.Empty)
{
this.Attributes.Add("onblur", String.Concat("javascript:this.style[\'background\']=\'", this.BackColor.Name.Replace("ff","#"), "\'"));
}
else
{
this.Attributes.Add("onblur", String.Concat("javascript:this.style[\'background\']=\'", "white", "\'"));
}
}
this.Attributes.Add("onkeydown", "javascript:if(event.keyCode==13) event.keyCode=9;");
base.Render(writer);
}
}}
给你一个简单的例子,此控件有在选中时变颜色和按下回车键设置下一个控件获得焦点的功能。