可能有些朋友還不是很清楚themes、skins。下面先介紹下themes、skins.。 App_Themes\default\1.skin文件代碼: <asp:Label Font-Bold="true" ForeColor="Red" runat="server" />
default.aspx:文件代碼: <%@ Page Language="C#" Theme="default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www./TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www./1999/xhtml"> <head id="Head1" runat="server"> <title>Page with Example Theme Applied</title> </head> <body> <form id="form1" runat="server"> <asp:Label ID="Label1" runat="server" Text="Hello 1" /><br /> <asp:Label ID="Label2" runat="server" Text="Hello 2" /><br /> </form> </body> </html> 可以看到我們?cè)赿efault.aspx并沒(méi)有寫(xiě)如何的控制style的代碼,但運(yùn)行取發(fā)現(xiàn)label上的字都變成了粗體紅色了,這就是1個(gè)最基本的theme例子。 2、在所有頁(yè)面應(yīng)用同1個(gè)Theme: 3、讓控件不應(yīng)用Theme: <asp:label runat="server" font-bold="true" forecolor="Red" />
<asp:label runat="server" SkinID="Blue" font-bold="true" forecolor="blue" /> deafult.aspx <%@ Page Language="C#" Theme="default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www./TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www./1999/xhtml"> <head id="Head1" runat="server"> <title>Page with Example Theme Applied</title> </head> <body> <form id="form1" runat="server"> <asp:Label ID="Label2" runat="server" Text="Hello 2" SkinID="Blue" /><br /> <asp:Label ID="Label3" runat="server" Text="Hello 3" /><br /> </form> </body> </html> 運(yùn)行后就會(huì)發(fā)現(xiàn)2個(gè)label顯示的風(fēng)格不一樣了。 <asp:Label Font-Bold="true" ForeColor="Red" runat="server" />
default.aspx <%@ Page Language="C#" Theme="default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www./TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www./1999/xhtml"> <head id="Head1" runat="server"> </head> <body> <form id="form1" runat="server"> <asp:Label ID="Label1" runat="server" Text="Hello 1" /><br /> <asp:Label ID="Label2" runat="server" Text="Hello 2" ForeColor="blue" /> </form> </body> </html> 運(yùn)行結(jié)果,所有的label的forecolor都為red。 控件應(yīng)用style屬性的順序如下: theme中包含CSS: |
|