在外部组件中嵌入图像?
我正在为我们公司的网站开发一个嵌入式组件。该组件允许用户互相发送消息。
为此,我在开发过程中遇到了几个问题,例如 LoadControl() 不起作用(因为它似乎与包括模块在内的项目相关,而不是与模块本身相关)。 我设法使用网上找到的方法解决了这个问题,但现在出现了下一个问题 - 图像。
为了使组件看起来更漂亮,用户会喜欢使用图像作为图标。 但是,我又陷入了同样的问题。
例如,如果我想要一个 ImageButton,我会将其 ImageUrl 属性设置为“~/images/message.png”,但这实际上引用了我的 DLL 内的某些内容,因此显然不起作用!
对于此类问题有标准的、好的解决方案吗?
谢谢!
I am developing a drop-in component for our company's websites. This component allows users to send messages to each other.
Making this, I've hit several problems during development, such as LoadControl() not working (as it seems to be relative to the project including the module, not the module itself).
I managed to fix this using an approach I found online, but now the next problem emerges - images.
To make the component look somewhat nice, images would be appreciated by the users for icons.
But, again, I am stuck at the same problem.
For instance, if I want an ImageButton, I would set it's ImageUrl property to "~/images/message.png", but this really references something inside my DLL and as such obviously doesn't work!
Is there a standard, good solution for this kind of problem?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 WebResources,请查看
http://www.aspcode。 net/Inclusion-WebResource-in-ASPNET-server-control.aspx
或将图像作为资源嵌入到控件程序集中,并使用 http 模块提供服务,但您必须在应用程序的 Web 配置中声明该 http 模块使用你的 控制。
You could use WebResources, look at
http://www.aspcode.net/Including-WebResource-in-ASPNET-server-control.aspx
or embedd image in control assembly as resource and serve it with http module, but you will have to declare that http module in web config of application that is using your control.