vs2005建立页面的主题

 

建立页面的主题

1.       建立一个新的目录App_Themes 在你的网站

注意你的目录必须命名为App_Themes

2.       建立一个子目录在你的App_Themes下去装载你的主题文件。

例如建立一个BlueTheme目录

3.       添加文件到你子目录下。例如添加Button.skin

4.       button.skin里写如下语句

<asp:Button runat="server"

 BackColor="Red"

 ForeColor="White"

 Font-Name="Arial"

 Font-Size="18px" SkinID="aa" />

 

<asp:Button runat="server"

 BackColor="Red"

 ForeColor="blue"

 Font-Name="Arial"

 Font-Size="18px" />

WebSite中应用你的主题

1 web.config里加入pages元素

 <configuration>

    <system.web>

          <pages theme="BlueTheme" />

    </system.web>

</configuration>

注意。这里的theme为你的子目录名称

2页面中使用

<asp:Button ID="Button1" runat="server" Text="Button" SkinID=aa/>

<asp:Button ID="Button2" runat="server" Text="Button" />

这样你看看你的效果

 How to: Disable ASP.NET Themes
To disable themes for a page

<%@ Page EnableTheming="false" %>

To disable themes for a control

<asp:Calendar id="Calendar1" runat="server" EnableTheming="false" />

动态更改主题   
protected void Page_PreInit(object sender, EventArgs e)
{

    this.Button2.SkinID = "aa";
    }

原文地址:https://www.cnblogs.com/meetweb/p/508618.html