如何使用图像资源在asp.net网站? [英] How to use image resource in asp.net website?
问题描述
我有一个C#网站,利用了很多嵌入式英文文本图像的。
I have a c# site which makes use of a lot of images with embedded english text.
我如何使用一个标准的资源文件,以换出根据语言形象?
How can I use a standard resource file to swap out images depending on the language?
我在我的App_GlobalResources文件目录的resx文件,但我似乎无法得到它插入一个asp:为正确的图片网址图像控制
I have a resx file in my App_GlobalResources directory, but I can't seem to get it plugged into an asp:image control for the imageurl correctly.
想法?
更新:
有关一些进一步的信息,这里是图片标签code:
For some further information, here is the image tag code:
<asp:image runat="server" ID="img2" ImageUrl="<%$Resources: Resource, cs_logo %>" />
在客户端的结果是:
The result on the client side is:
<img id="img2" src="System.Drawing.Bitmap" style="border-width:0px;" />
请注意,源显然不是我所期望的......
Note that the source is obviously not what I expected...
推荐答案
您可以将图片的URL存储在您的资源文件,并使用下面的直列code对照
you can store the url of the image in your resource file and use the following inline code in the control
<asp:Image ImageUrl="<%$resources:Image1 %>" />
更新
这链接可能是您所要完成的有益
Update
this link could be helpful on what you are trying to accomplish
或
您也可以尝试存储资源的字符串,其值设置为URL位置,而不是在种源文件中的图像存储的。
you can also try to stored the resource as string and set the value to the url location instead of storing the image in the resouce file.
这篇关于如何使用图像资源在asp.net网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!