WebControl.ForeColor WebControl.ForeColor WebControl.ForeColor WebControl.ForeColor Property

Definición

Obtiene o establece el color de primer plano (normalmente el color del texto) del control de servidor web.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

Valor de propiedad

Color que representa el color de primer plano del control.A Color that represents the foreground color of the control. De manera predeterminada, es Empty.The default is Empty.

Ejemplos

En el ejemplo siguiente se muestra cómo establecer la ForeColor propiedad Table del control, heredada de la WebControl clase base.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>

Comentarios

Utilice la ForeColor propiedad para especificar el color de primer plano del control de servidor Web.Use the ForeColor property to specify the foreground color of the Web server control. El color de primer plano suele ser el color del texto.The foreground color is usually the color of the text. Esta propiedad se representará en exploradores anteriores a Microsoft Internet Explorer versión 4 para todos los controles Image, AdRotatorexcepto HyperLink , LinkButtony.This property will render on browsers earlier than Microsoft Internet Explorer version 4 for all controls, except the Image, AdRotator, HyperLink and LinkButton.

Nota

En exploradores anteriores a Microsoft Internet Explorer versión 4, esta propiedad se representa como <font> etiquetas.On browsers earlier than Microsoft Internet Explorer version 4, this property is rendered as <font> tags.

Se aplica a

Consulte también: