using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; /// <summary> /// custom1 的摘要说明 /// </summary> namespace MyControls { public class FullyRenderedControl : Control { private string _Text; public string Text { get { return _Text; } set { _Text = value; } } protected override void Render(HtmlTextWriter writer) { writer.Write(_Text); } } //the second custom control public class FullyRenderedWebControl : WebControl { private string _Text; public string Text { get { return _Text; } set { _Text = value; } } protected override void RenderContents(HtmlTextWriter writer) { writer.Write(_Text); } } //DropShadow public class DropShadow : WebControl { private string _Text; public string Text { get { return _Text; } set { _Text = value; } } protected override void RenderContents(HtmlTextWriter writer) { writer.AddStyleAttribute(HtmlTextWriterStyle.Filter, "dropShadow(color=#FFFFFF,offX=3,offY=3);width:500px"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write(_Text); writer.RenderEndTag(); } } public class Glow : WebControl { private string _Text; public string Text { get { return _Text; } set { _Text = value; } } protected override HtmlTextWriterTag TagKey { get { return HtmlTextWriterTag.Div; } } protected override void AddAttributesToRender(HtmlTextWriter writer) { writer.AddStyleAttribute(HtmlTextWriterStyle.Filter, "glow(Color=#ffd700,Strength=100)"); base.AddAttributesToRender(writer); } protected override void RenderContents(HtmlTextWriter writer) { writer.Write(_Text); } public Glow() { this.Width = Unit.Parse("500px"); } } }