©
This document uses PHP Chinese website manual Release
BackColor 属性用于设置或返回控件的背景颜色。
<asp:webcontrol id="id" BackColor="color" runat="server" />
属性 | 描述 |
---|---|
color | 设置为控件的背景颜色的颜色。必须是合法的 HTML 颜色。 |
下面的实例设置了按钮的背景颜色:
<form runat="server">
<asp:Button id="button1" Text="Submit"
BackColor="#FFCC80" runat="server" />
</form>
设置 Button 控件的背景色(带有声明和脚本)
<%@ Import Namespace="System.Drawing" %> <!DOCTYPE html> <html> <head> <script runat="server"> Sub ChangeBackColor(obj As Object, e As EventArgs) button1.BackColor = Color.FromName("Red") End Sub </script> </head> <body> <form runat="server"> <asp:Button id="button1" runat="server" BackColor="#FFCC80" Text="Change" OnClick="ChangeBackColor" /> </form> </body> </html>