HtmlTableRow.BgColor プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HtmlTableRow.BgColor プロパティの意味・解説 

HtmlTableRow.BgColor プロパティ

HtmlTableRow クラスインスタンス表される行の背景色取得または設定します

名前空間: System.Web.UI.HtmlControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

解説解説

BgColor プロパティ使用してHtmlTableRow クラスインスタンス表される行の背景色指定します。色は、名前で指定するか、16 進値の前にシャープ記号 (#) を付けて #RRGGBB の形式指定できますRRGG、および BBそれぞれ、色の赤、緑、および青の各要素を示す 0 ~ 255範囲16 進値を表します。たとえば、#0000FF という値は青を表します。これは、赤と緑の要素最小値 (00) を指定し、青の要素最大値 (FF) を指定します

16 種類の定義済みHTML カラーの名前と、BgColor プロパティ使用できる対応する 16 進値を次の表に示しますHTML カラー詳細については、W3C (World Wide Web Consortium) Web サイト参照してください

カラー

16 進

Aqua

#00FFFF

Black

#000000

Blue

#0000FF

Fuchsia

#FF00FF

Gray

#808080

Green

#008000

Lime

#00FF00

Maroon

#800000

Navy

#000080

Olive

#808000

Purple

#800080

Red

#FF0000

Silver

#C0C0C0

Teal

#008080

White

#FFFFFF

Yellow

#FFFF00

BgColor プロパティ使用できる色は、KnownColor 列挙体から判断できます

カラー名では大文字と小文字区別されません。

使用例使用例

BgColor プロパティ使用して、HtmlTable コントロール内の行の背景色制御する方法次のコード例示します

<%@ Page Language="VB" AutoEventWireup="True"
 %>

<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>
<head>
   <title>HtmlTableRow Example</title>
</head>
<body>

   <form runat="server">

      <h3>HtmlTableRow Example</h3>

      <table id="Table1" 
             border="1" 
             bordercolor="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>White</option>
        
      </select>

      &nbsp;&nbsp;

      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>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>
<%@ Page Language="C#" AutoEventWireup="True" %>

<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>
<head>
   <title>HtmlTableRow Example</title>
</head>
<body>

   <form runat="server">

      <h3>HtmlTableRow Example</h3>

      <table id="Table1" 
             border="1" 
             bordercolor="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>White</option>
        
      </select>

      &nbsp;&nbsp;

      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>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="JScript" AutoEventWireup="True" %>
   
<script runat="server">

  function Button_Click(sender, e : EventArgs) 
  {

    // Iterate through the rows of the table.
    for (var i : int=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>
<head>
   <title>HtmlTableRow Example</title>
</head>
<body>

   <form runat="server">

      <h3>HtmlTableRow Example</h3>

      <table id="Table1" 
             border="1" 
             bordercolor="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>White</option>
        
      </select>

      &nbsp;&nbsp;

      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>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>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HtmlTableRow クラス
HtmlTableRow メンバ
System.Web.UI.HtmlControls 名前空間
HtmlTableRow.BgColor プロパティ
BorderColor
Height
HtmlTableRow.Align プロパティ
VAlign
KnownColor
その他の技術情報
HTML サーバー コントロール


このページでは「.NET Framework クラス ライブラリ リファレンス」からHtmlTableRow.BgColor プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からHtmlTableRow.BgColor プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からHtmlTableRow.BgColor プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「HtmlTableRow.BgColor プロパティ」の関連用語

HtmlTableRow.BgColor プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HtmlTableRow.BgColor プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS