日期:2014-05-18 浏览次数:20442 次
namespace WDemo { [DefaultProperty("Text")] [ToolboxData("<{0}:TextButton runat=server></{0}:TextButton>")] public class TextButton : WebControl, INamingContainer { [Bindable(true)] [Category("Appearance")] [DefaultValue("")] [Localizable(true)] TextBox tb; Button b; public delegate void dl(object sender,EventArgs e); public event dl TextButtonClick; public TextButton() { tb = new TextBox(); b = new Button(); b.Text = "提交"; b.Click += new EventHandler(b_Click); } void b_Click(object sender, EventArgs e) { TextButtonClick(sender,e); } public string TextContent { get { return tb.Text; } set { tb.Text = value; } } protected override void CreateChildControls() { Controls.Add(tb); Controls.Add(b); // base.CreateChildControls(); } } }