使用主题来自动包装控件样式

管理网站可以直接使用这种主题,很方便。

建立一个主题文件夹,css代码如下:

body
{
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    font-weight
: normal;
    color
: #000000;
}

.TableBG
{    
    background-color
: #cccccc;
}

.ItemStyle 
{
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    font-weight
: normal;
    color
: #000000;
    background-color
: #FFFFFF;
    line-height
: 20px;    
}

.AlternateItemStyle 
{
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    line-height
: 15pt;
    font-weight
: normal;
    color
: #000000;
    background-color
: #F1F7FC;
    
}

.HeaderStyle 
{
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    line-height
: 15pt;
    font-weight
: bold;
    color
: #FFFFFF;
    background-image
: url(images/tile_back.gif);    
    text-align
:center;
}

.FooterStyle 
{
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    line-height
: 15pt;
    font-weight
: normal;
    color
: #000000;
    background-image
: url(images/tile_sub.gif);
    text-align
:center;
}


{
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    font-weight
: normal;
    color
: #000000;
    text-decoration
: none;
    cursor
: hand;
}

a:hover 
{
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    font-weight
: normal;
    color
: #4083D5;
    text-decoration
: none;
    cursor
: hand;
    background-color
: #FFFFFF;
}

a.a2
 
{
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    font-weight
: bold;
    color
: #FFFFFF;
    text-decoration
: none;
    cursor
: hand;
}

a.a2:hover 
{
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    font-weight
: bold;
    color
: #4083D5;
    text-decoration
: none;
    cursor
: hand;
    background-color
: #FFFFFF;
}

.TextBox
{
    onfocus
:expression(onfocus=function (){this.style.borderColor ='#4083D5';});
    onblur: expression(onblur=function ()
{this.style.borderColor='#CCCCCC';});
    font-family: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size: 9pt;
    color: #000000;    
    border: 1pt solid #CCCCCC;
    height: 18px;
}


.Button
{
    onmouseover
:expression(onmouseover=function (){this.style.color='#0a246a';});
    onmouseout: expression(onmouseout=function ()
{this.style.color='#000000';});
    height: 18pt;
    font-family: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size: 9pt;
    font-weight: normal;
    color: #000000;
}

.DropDownList
{
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    font-weight
: normal;
    color
: #000000;
}

.ListBox
{
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    font-weight
: normal;
    color
: #000000;
}

.CheckBoxList
{
    padding
: 4px;
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    font-weight
: normal;
    border
: 1pt solid #CCCCCC;
    color
: #000000;
}

.RadioButtonList
{
    padding
: 4px;
    font-family
: Verdana, Lucida, Arial, Helvetica, "宋体", sans-serif;
    font-size
: 9pt;
    font-weight
: normal;
    border
: 1pt solid #CCCCCC;
    color
: #000000;
}

skin文件代码如下:

<asp:TextBox runat="server" CssClass="TextBox" />
<asp:Button runat="server" CssClass="Button"/>
<asp:DropDownList runat="server" CssClass="DropDownList"/>
<asp:ListBox runat="server" CssClass="ListBox" />
<asp:CheckBoxList runat="server" CssClass="CheckBoxList" />
<asp:RadioButtonList runat="server" CssClass="RadioButtonList" />
<asp:GridView runat="server" CssClass="TableBG" BorderWidth="0" CellPadding="5" CellSpacing="1">
    
<RowStyle CssClass="ItemStyle" />
    
<AlternatingRowStyle CssClass="AlternateItemStyle" />
    
<PagerStyle CssClass="FooterStyle" />
    
<HeaderStyle CssClass="HeaderStyle" />
</asp:GridView>

完整主题文件夹下载:点击这里下载
posted @ 2007-08-19 12:49  lovecherry  阅读(4565)  评论(2编辑  收藏  举报