ASP.NET中主题的创建和应用

2023-05-16

1创建ASP.NET网站 模板->选择 添加ASP.NET文件夹 下面的属性,将主题名改为:mytheme;添加新建项选择 外观文件,命名为TextBox。双击TextBox.skin文件,输入以下代码:

<asp:Label runat="server" Font-Bold="true" ForeColor="Red"></asp:Label>
<asp:TextBox runat="server" BackColor="#C0FFFF" BorderColor="#8080FF"
BorderStyle="Solid"></asp:TextBox>
<asp:Button runat="server" BackColor="#FFE0C0" BorderColor="#FF8000" BorderStyle="Dotted"></asp:Button>

2打开Default.aspx文件选择设计视图, 拖入一个Label控件 命名为:请输入用户名,拖入一个TextBox控件,拖入一个Button控件,命名为:提交。

然后选择源视图,修改代码如下:

<%@ Page Title="主页" Language="C#" Theme="mytheme" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="WebApplication13._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <asp:Label ID="Label1" runat="server" Text="请输入用户名:"></asp:Label>
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <br />
    <asp:Button ID="Button1" runat="server" Text="提交" />
    <br />
</asp:Content>
3运行程序,结果如图所示:




本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ASP.NET中主题的创建和应用 的相关文章

随机推荐