HtmlTableRow.BorderColor Proprietà

Definizione

Ottiene o imposta il colore del bordo della riga rappresentata da un'istanza della classe HtmlTableRow.

public:
 property System::String ^ BorderColor { System::String ^ get(); void set(System::String ^ value); };
public string BorderColor { get; set; }
member this.BorderColor : string with get, set
Public Property BorderColor As String

Valore della proprietà

String

Colore del bordo della riga rappresentata da un'istanza della classe HtmlTableRow.

Esempio

Nell'esempio di codice seguente viene illustrato come utilizzare la BorderColor proprietà per controllare il colore del bordo di una riga nel HtmlTable controllo .

<%@ 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">

  void Button_Click(Object sender, EventArgs e)
  {

    // Iterate through the rows of the table.
    for (int i = 0; i <= Table1.Rows.Count - 1; i++)
    {

      // Update the properties of each row. 
      Table1.Rows[i].BgColor = BgColorSelect.Value;
      Table1.Rows[i].BorderColor = BorderColorSelect.Value;
      Table1.Rows[i].Height = HeightSelect.Value;

    }

  }

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <title>HtmlTableRow Example</title>
</head>
<body>

   <form id="form1" runat="server">

      <h3>HtmlTableRow Example</h3>

      <table id="Table1" 
             style="border-width:1; border-color:Black"
             runat="server">

         <tr>
            <td>
               Cell 1.
            </td>
            <td>
               Cell 2.
            </td>
         </tr>
         <tr>
            <td>
               Cell 3.
            </td>
            <td>
               Cell 4.
            </td>
         </tr>

      </table>

      <hr />

      Select the display settings for the rows in the table: <br /><br />

      BgColor:
      <select id="BgColorSelect" 
              runat="server">

         <option value="Red">Red</option>
         <option value="Blue">Blue</option>
         <option value="Green">Green</option>
         <option value="Black">Black</option>
         <option value="White" selected="selected">White</option>
        
      </select>

        

      BorderColor:
      <select id="BorderColorSelect" 
              runat="server">

         <option value="Red">Red</option>
         <option value="Blue">Blue</option>
         <option value="Green">Green</option>
         <option value="Black" selected="selected">Black</option>
         <option value="White">White</option>

      </select>

      <br /><br />

      Height:
      <select id="HeightSelect" 
              runat="server">

         <option value="0">0</option>
         <option value="100">100</option>
         <option value="150">150</option>
         <option value="200">200</option>
         <option value="250">250</option>

      </select>
       
      <br /><br />
  
      <input type="button" 
             value="Generate Table"
             onserverclick="Button_Click" 
             runat="server"/>

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

  Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)

    Dim i As Integer

    ' Iterate through the rows of the table.
    For i = 0 To Table1.Rows.Count - 1

      ' Update the properties of each row. 
      Table1.Rows(i).BgColor = BgColorSelect.Value
      Table1.Rows(i).BorderColor = BorderColorSelect.Value
      Table1.Rows(i).Height = HeightSelect.Value

    Next i

  End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <title>HtmlTableRow Example</title>
</head>
<body>

   <form id="form1" runat="server">

      <h3>HtmlTableRow Example</h3>

      <table id="Table1" 
             style="border-width:1; border-color:Black"
             runat="server">

         <tr>
            <td>
               Cell 1.
            </td>
            <td>
               Cell 2.
            </td>
         </tr>
         <tr>
            <td>
               Cell 3.
            </td>
            <td>
               Cell 4.
            </td>
         </tr>

      </table>

      <hr />

      Select the display settings for the rows in the table: <br /><br />

      BgColor:
      <select id="BgColorSelect" 
              runat="server">

         <option value="Red">Red</option>
         <option value="Blue">Blue</option>
         <option value="Green">Green</option>
         <option value="Black">Black</option>
         <option value="White" selected="selected">White</option>
        
      </select>

        

      BorderColor:
      <select id="BorderColorSelect" 
              runat="server">

         <option value="Red">Red</option>
         <option value="Blue">Blue</option>
         <option value="Green">Green</option>
         <option value="Black" selected="selected">Black</option>
         <option value="White">White</option>

      </select>

      <br /><br />

      Height:
      <select id="HeightSelect" 
              runat="server">

         <option value="0">0</option>
         <option value="100">100</option>
         <option value="150">150</option>
         <option value="200">200</option>
         <option value="250">250</option>

      </select>
       
      <br /><br />
  
      <input id="Button1" type="button" 
             value="Generate Table"
             onserverclick="Button_Click" 
             runat="server"/>

   </form>

</body>
</html>

Commenti

Utilizzare la BorderColor proprietà per specificare il colore del bordo della riga rappresentata da un'istanza della HtmlTableRow classe. È possibile specificare un colore in base al nome o usando un valore esadecimale, preceduto dal carattere di sterlina (#), nel formato #RRGGBB. RR, GG e BB rappresentano rispettivamente valori esadecimali da 0 a 255 che indicano i componenti rossi, verdi e blu di un colore. Ad esempio, il valore #0000FF rappresenta il colore blu. Specifica il valore minimo (00) per i componenti rossi e verdi, specificando il valore massimo (FF) per il componente blu.

La tabella seguente mostra i sedici nomi di colore HTML predefiniti e i valori esadecimali corrispondenti che possono essere usati per la BorderColor proprietà. Per altre informazioni sui colori HTML, vedere il sito Web World Wide Web Consortium (W3C).

Nome colore Valore esadecimale
Verde acqua #00FFFF
Black #000000
Blu #0000FF
Fucsia #FF00FF
Grigio #808080
Green #008000
Limone #00FF00
Bordeaux #800000
Navy #000080
Oliva #808000
Viola #800080
Red #FF0000
Argento #C0C0C0
Verde acqua #008080
White #FFFFFF
Giallo #FFFF00

I colori disponibili da utilizzare con la BorderColor proprietà possono essere determinati dall'enumerazione KnownColor .

I nomi dei colori non fanno distinzione tra maiuscole e minuscole.

Si applica a

Vedi anche