ASP.NET 是否内置了对皮肤徽标的支持?

发布于 2024-07-10 21:30:16 字数 163 浏览 6 评论 0原文

我仅使用徽标作为示例。

我第一次尝试在 ASP.NET 中使用主题/皮肤,只是想弄清楚它们到底能让我做什么。

据我所知,主题主要用于更改按钮等控件,可以使用图像进行修改。 但是有没有办法可以使用主题为“徽标”或其他图形换肤? 阅读文档后我无法立即找到这样做的方法。

I'm using logos as just an example.

I'm trying to use themes/skins for the first time in ASP.NET - and just trying to figure out exactly what they will allow me to do.

As far as i can tell themes are primarily for changing controls like buttons, which can be modified using images. But is there a way I can skin a 'logo' or other graphics using themes? Reading the documentation I couldnt immediately see a way of doing so.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦萦几度 2024-07-17 21:30:16

您可以使用主题/皮肤轻松设置图像/徽标。 例如,如果您有这样的图像控件:

<asp:Image id="imgLogo" runat="server" SkinId="logo" ... />

在您的皮肤文件中,您可以指定要显示的图像,例如在 App_Themes/theme1/logo.skin 中:

<asp:Image runat="server" SkinId="logo" ImageUrl="~/images/logo1.png" />

在 App_Themes/theme2/logo.skin 中:

<asp:Image runat="server" SkinId="logo" ImageUrl="~/images/logo2.png" />

这不限于ImageUrl 属性。 您可以从外观文件设置控件的大部分属性。

You can easily set an image/logo using themes/skins. E.g. if you have an image control like this:

<asp:Image id="imgLogo" runat="server" SkinId="logo" ... />

In your skin files, you can then specifiy the image to be displayed, e.g. in App_Themes/theme1/logo.skin:

<asp:Image runat="server" SkinId="logo" ImageUrl="~/images/logo1.png" />

And in App_Themes/theme2/logo.skin:

<asp:Image runat="server" SkinId="logo" ImageUrl="~/images/logo2.png" />

This is not limited to the ImageUrl property. You can set most of the properties of controls from skin files.

差↓一点笑了 2024-07-17 21:30:16

我最近使用 ASP.net 主题创建了一个动态品牌网站,其中包含不同的徽标和其他图像,具体取决于将用户发送到该网站的附属机构。 这听起来像是你想要的。 为了实现这一目标,我执行了以下操作:

  1. 创建了多个主题,包括 css 和图像(未使用外观文件)。 您可以在 css 中使用相对引用来显示主题文件夹中存储的背景图像。
  2. 创建了我自己的页面类,该类重写 OnPreInit 事件并将 Page.Theme 设置为我确定应使用的任何主题。 对我来说这是基于 cookie,但也可以基于您想要识别用户的任何方式。
  3. 确保所有页面都继承自新页面类。

I recently used ASP.net themes to create a dynamically branded site with different logos and other images depending on the affiliate that sent the user to the site. This sounds like what you are going for. To accomplish this, I did the following:

  1. Created several themes, including css and images (no skin files were used). You can use relative references in your css to display background images stored in your theme folder.
  2. Created my own page class that overrides the OnPreInit event and sets Page.Theme to whatever theme I determine should be used. This is based on cookies for me, but could be based on any way you want to identify the user.
  3. Make sure that all your pages inherit from your new page class.
垂暮老矣 2024-07-17 21:30:16

使用主题,您可以轻松地将图像 ASP.NET 控件的源设置为每个主题都不同。 (如果尺寸不同的话,还有尺寸)。

主题概述:http://msdn.microsoft.com/en-us/library /ykzx33wh.aspx

using the themes you could easily set the source of an Image ASP.NET control to be different per theme. (also the sizes if they were different).

Themes overview: http://msdn.microsoft.com/en-us/library/ykzx33wh.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文