现在做了一个web自定义控件,但里面含有一个图像,我想把这个图像也打包在dll文件中,然后在引用控件的时候,直接就把图像显示出来了,在自定义控件里怎么写,怎么把图像打包进去呢?protected override void Render(HtmlTextWriter output)
{
string _html = "<table border=\"1"><tr><td><img src=\"图像\">"+this._text+"</td></tr></table>"; output.Write(_html);
}
{
string _html = "<table border=\"1"><tr><td><img src=\"图像\">"+this._text+"</td></tr></table>"; output.Write(_html);
}
解决方案 »
- Linqdatasource数据源控件如何取得前5行数据
- 竞拍怎么实现
- Gridview实现数据源分页的问题
- 问下有没有固定rdlc柱状图宽度的方法?
- 如何使自己的OA程序只在自己授权的服务器上架设呢?
- 编辑十多条记录后,再打开编辑页面,有时候会出现白屏.这时,只有关闭程序,重新打开来编辑,我想,是执行效率的问题,但具体原因不太清楚.请问,
- 人人都会得到学习、提高的一道js问题。
- 实在没分了~Ajax问题~孟子请进~好心人也请进~小弟跪求了!
- 贴出我的第一个asp.net程序以示纪念
- 风讯.NET CMS标签使用
- 一个关于日历控件的问题。
- ■ 10万条记录的新闻数据库, 用 %变量% 搜索标题没有问题,但是搜索 新闻内容 就内存溢出, 甚至在 5万 条就内存溢出!
要把图片当做嵌入的资源来编译。你选中文件,在属性里面,生成操作选项选中“嵌入的资源”
以下是把一个html加入到资源中。
你可以改一下,把图片加到入资源中。
在CS代码中加入
if(!System.IO.File.Exists(System.Web.HttpContext.Current.Server.MapPath("/aspnet_client/system_web/GUIK/Calendar_CN.htm")))
{
Stream stream;
Assembly a = Assembly.GetExecutingAssembly();
stream = a.GetManifestResourceStream("Ghost.Control.Calendar.aspnet_client.Calendar_CN.htm");
System.IO.Directory.CreateDirectory(System.Web.HttpContext.Current.Server.MapPath("/aspnet_client/system_web/GUIK"));
FileStream fs = new FileStream(System.Web.HttpContext.Current.Server.MapPath("/aspnet_client/system_web/GUIK/Calendar_CN.htm"), System.IO.FileMode.Create, FileAccess.Write);
StreamReader sr = new StreamReader(stream);
string html = sr.ReadToEnd(); System.IO.StreamWriter sw = new StreamWriter(fs);
sw.BaseStream.Seek(0, SeekOrigin.End);
sw.WriteLine(html);
sw.Flush();
sw.Close();
sr.Close();
fs.Close();
stream.Close();
}
这样就把资源复制到文件夹中,使用时注意路径就行。