WebControl.BackColor 속성

정의

웹 서버 컨트롤의 배경색을 가져오거나 설정합니다.

public:
 virtual property System::Drawing::Color BackColor { System::Drawing::Color get(); void set(System::Drawing::Color value); };
[System.ComponentModel.Bindable(true)]
[System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))]
public virtual System.Drawing.Color BackColor { get; set; }
[System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))]
public virtual System.Drawing.Color BackColor { get; set; }
[<System.ComponentModel.Bindable(true)>]
[<System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))>]
member this.BackColor : System.Drawing.Color with get, set
[<System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))>]
member this.BackColor : System.Drawing.Color with get, set
Public Overridable Property BackColor As Color

속성 값

컨트롤의 배경색을 나타내는 Color입니다. 기본값은 Empty로, 이 속성이 설정되어 있지 않음을 나타냅니다.

특성

예제

다음 예제에서는 설정 하는 방법을 보여 줍니다는 BackColor 의 속성을 Table 컨트롤에서 상속 된를 WebControl 기본 클래스.

<%@ Page Language="C#" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>BackColor Property</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h3>BackColor Property of a Web Control</h3>
 
        <asp:Table id="Table1" runat="server"
            CellPadding = "10" 
            GridLines="Both"
            BackColor="LightBlue">
            <asp:TableRow>
                <asp:TableCell>
                    Row 0, Col 0
                </asp:TableCell>
                <asp:TableCell>
                    Row 0, Col 1
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow>
                <asp:TableCell>
                    Row 1, Col 0
                </asp:TableCell>
                <asp:TableCell>
                    Row 1, Col 1
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </div>
    </form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>BackColor Property</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h3>BackColor Property of a Web Control</h3>
 
        <asp:Table id="Table1" runat="server"
            CellPadding = "10" 
            GridLines="Both"
            BackColor="LightBlue">
            <asp:TableRow>
                <asp:TableCell>
                    Row 0, Col 0
                </asp:TableCell>
                <asp:TableCell>
                    Row 0, Col 1
                </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow>
                <asp:TableCell>
                    Row 1, Col 0
                </asp:TableCell>
                <asp:TableCell>
                    Row 1, Col 1
                </asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </div>
    </form>
</body>
</html>

설명

사용 된 BackColor 속성을 통해 웹 서버 컨트롤의 배경색을 지정 합니다. 이 속성을 사용 하 여 설정 된 System.Drawing.Color 개체입니다.

참고

이 속성은 특정 컨트롤에 렌더링 됩니다. 예를 들어 Table, PanelDataGridCalendar, 및 ValidationSummary 이 속성을 렌더링 합니다. 에 대해서도 작동 CheckBoxList, RadioButtonList 하 고 DataList 경우 해당 RepeatLayout 속성은 RepeatLayout.Table아니라 RepeatLayout.Flow합니다.

일반적으로으로 렌더링 되는 제어를 <table> 결과가 거의 모든 컨트롤이 HTML 4.0에서 태그 HTML 3.2에서는 배경 색을 표시할 수 있습니다.

으로 렌더링 하는 컨트롤에 대 한는 <span> 태그 (포함 Label모든 유효성 검사 컨트롤 및 목록 컨트롤과 해당 RepeatLayout 속성이로 설정 RepeatLayout.Flow),이 속성은 아닌 Microsoft Internet Explorer 5 이상 버전에서에서 작동 됩니다 Microsoft Internet explorer 버전 4입니다.

적용 대상

추가 정보