WebControl.ForeColor 속성

정의

웹 서버 컨트롤의 전경색(보통 텍스트 색)을 가져오거나 설정합니다.Gets or sets the foreground color (typically the color of the text) of the Web server control.

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

속성 값

컨트롤의 전경색을 나타내는 Color입니다.A Color that represents the foreground color of the control. 기본값은 Empty입니다.The default is Empty.

특성

예제

다음 예제에서는 설정 하는 방법을 보여 줍니다를 ForeColor 의 속성을 Table 에서 상속 된 컨트롤을 WebControl 기본 클래스.The following example illustrates how to set the ForeColor property of the Table control, inherited from the WebControl base class.

<%@ 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>Table Property</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h3>Property of a Table Web Control</h3>
 
        <asp:Table id="Table1" runat="server"
            CellPadding = "10" 
            CellSpacing="0"
            GridLines="Both"
            Font-Bold="true"
            ForeColor="Red">

            <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" 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>Table Property</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h3>Property of a Table Web Control</h3>
 
        <asp:Table id="Table1" runat="server"
            CellPadding = "10" 
            CellSpacing="0"
            GridLines="Both"
            Font-Bold="true"
            ForeColor="Red">

            <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>

설명

사용 된 ForeColor 속성을 통해 웹 서버 컨트롤의 전경색을 지정 합니다.Use the ForeColor property to specify the foreground color of the Web server control. 전경색은 대개 텍스트의 색입니다.The foreground color is usually the color of the text. 제외 하 고 Microsoft Internet Explorer 버전 4 모든 컨트롤에 대 한 이전 브라우저에서이 속성은 렌더링 합니다 Image, AdRotatorHyperLinkLinkButton합니다.This property will render on browsers earlier than Microsoft Internet Explorer version 4 for all controls, except the Image, AdRotator, HyperLink and LinkButton.

참고

브라우저에서 Microsoft Internet Explorer 버전 4 이전의이 속성은 렌더링으로 <font> 태그입니다.On browsers earlier than Microsoft Internet Explorer version 4, this property is rendered as <font> tags.

적용 대상

추가 정보