第一天看这本书,今天学了<<<主题和皮肤>>节 ,就算是一个好是习惯吧,以后把学过的东西都写一下:
创建控件皮肤的简单方法:
1.将在可视化的环境中先设置好控件是样式
2.将控件的代码复制到皮肤文件中,并做适当的修改
3.注意:
千万别忘了移除皮肤文件中控件的id属性;
4.引用样式是要设置网页的 Tteme 属性
看这节的时候,我最后的动态加载主题是调不出来了..再看<<天轰穿>>的入门教程相关部分,呵呵~~~ 终于把它做好了:
还有句川哥的话:
不要轻易对表格(table,tr,td)这些元素使用css元素定义,可以用类定义,因为我们很
多复合控件体现出来的都是表格
在web.config文件中使用
<system.web>
<pages theme="red"/>
</sydtem.web>
用按钮实现主题切换部分的代码:
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
1
public partial class _Default : System.Web.UI.Page
2![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
3![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
4
protected void page_PreInit(object sender, EventArgs e)
5![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
6
if (Request.QueryString["t"] != null)
7![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
8
Page .Theme = Request.QueryString["t"].ToString();
9
}
10
}
11![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
12
protected void Button1_Click(object sender, EventArgs e)
13![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
14
Response.Redirect("default.aspx?t=red");
15
}
16
protected void Button2_Click(object sender, EventArgs e)
17![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
18
Response.Redirect("default.aspx?t=blue");
19
}
20
}