在VS 2005里出现了一个Theme的东西,与之对应的配置文件是.skin后缀的文件,一般是默认放在网站App_Themes目录下,那它的作用就是对页面上的服务器控件的外观,字体,背景等等进行定义,如果没有指定控件ID,将表示使用该Themes的页面的此类控件都使用这样的外观,确切的说,是主题,如何引用,和CSS一样,在文件顶部调用,CSS文件要有完整、准确的文件路径,Themes却只要指定主题名字,就可以了,就是文件名字。
<%@ Page Language="C#" StylesheetTheme="BasicTheme" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
.skin文件的具体定义可以看下面的说明,总之,一类控件共有的属性都可以定义。<%--
Default skin template. The following skins are provided as examples only.
1. Named control skin. The SkinId should be uniquely defined because
duplicate SkinId's per control type are not allowed in the same theme.
<asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" >
<AlternatingRowStyle BackColor="Blue" />
</asp:GridView>
2. Default skin. The SkinId is not defined. Only one default
control skin per control type is allowed in the same theme.
<asp:Image runat="server" ImageUrl="~/images/image1.jpg" />
--%>
<system.web>
<pages theme="GridViewTheme" />
</system.web>
本文介绍在Visual Studio 2005中使用Themes和CSS来定制网页服务器控件外观的方法。详细解释了.skin文件的用途及其如何与页面结合使用,并展示了如何在Web.config中设置主题。
3159

被折叠的 条评论
为什么被折叠?



