#region WebResource Demo using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls; [assembly: WebResource("WebCtrl.cutecat.jpg", "image/jpg")] namespace WebCtrl
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:WebCustom runat=server></{0}:WebCustom>")]
public class WebCustom : WebControl
{
private string text;
private Image m_Image; [Bindable(true)]
[Category("Appearance")]
[DefaultValue("")]
public string Text
{
get { return text; }
set { text = value; }
} protected override void CreateChildControls()
{
m_Image = new Image();
this.Controls.Add(m_Image);
} protected override void Render(HtmlTextWriter output)
{
m_Image.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(WebCustom), "WebCtrl.cutecat.jpg");
this.RenderChildren(output);
}
}
}
#endregion
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls; [assembly: WebResource("WebCtrl.cutecat.jpg", "image/jpg")] namespace WebCtrl
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:WebCustom runat=server></{0}:WebCustom>")]
public class WebCustom : WebControl
{
private string text;
private Image m_Image; [Bindable(true)]
[Category("Appearance")]
[DefaultValue("")]
public string Text
{
get { return text; }
set { text = value; }
} protected override void CreateChildControls()
{
m_Image = new Image();
this.Controls.Add(m_Image);
} protected override void Render(HtmlTextWriter output)
{
m_Image.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(WebCustom), "WebCtrl.cutecat.jpg");
this.RenderChildren(output);
}
}
}
#endregion
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货