HtmlTableRow.Align プロパティ
アセンブリ: System.Web (system.web.dll 内)

HtmlTable コントロールの行のセルの内容の水平方向の配置。既定値は String.Empty で、このプロパティが設定されていないことを示します。

Align プロパティを使用して、HtmlTable コントロールの行のセルの内容の水平方向の配置を指定します。
![]() |
---|
このプロパティを設定すると、HtmlTableRow クラスのインスタンスで表されるテーブルの行のすべてのセルに影響します。行の単一のセルに配置属性を適用するには、そのセルの Align プロパティを設定します。 |

Align プロパティを使用して、行全体のセルの内容の水平方向の配置を制御する方法を次の例に示します。
<%@ 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).Align = AlignSelect.Value Table1.Rows(i).VAlign = VAlignSelect.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> Here is some content for Cell 1. </td> <td> Here is some content for Cell 2. </td> </tr> <tr> <td width="100" height="100"> Here is some content for Cell 3. </td> <td width="100" height="100"> Here is some content for Cell 4. </td> </tr> </table> <hr> Select the display settings for the cells in the table: <br><br> Align: <select id="AlignSelect" runat="server"> <option value="Left" selected>Left</option> <option value="Center">Center</option> <option value="Right">Right</option> </select> VAlign: <select id="VAlignSelect" runat="server"> <option value="Top">Top</option> <option value="Middle" selected>Middle</option> <option value="Bottom">Bottom</option> </select> <br><br> <input 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].Align = AlignSelect.Value; Table1.Rows[i].VAlign = VAlignSelect.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> Here is some content for Cell 1. </td> <td> Here is some content for Cell 2. </td> </tr> <tr> <td width="100" height="100"> Here is some content for Cell 3. </td> <td width="100" height="100"> Here is some content for Cell 4. </td> </tr> </table> <hr> Select the display settings for the cells in the table: <br><br> Align: <select id="AlignSelect" runat="server"> <option value="Left" selected>Left</option> <option value="Center">Center</option> <option value="Right">Right</option> </select> VAlign: <select id="VAlignSelect" runat="server"> <option value="Top">Top</option> <option value="Middle" selected>Middle</option> <option value="Bottom">Bottom</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].Align = AlignSelect.Value; Table1.Rows[i].VAlign = VAlignSelect.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> Here is some content for Cell 1. </td> <td> Here is some content for Cell 2. </td> </tr> <tr> <td width="100" height="100"> Here is some content for Cell 3. </td> <td width="100" height="100"> Here is some content for Cell 4. </td> </tr> </table> <hr> Select the display settings for the cells in the table: <br><br> Align: <select id="AlignSelect" runat="server"> <option value="Left" selected>Left</option> <option value="Center">Center</option> <option value="Right">Right</option> </select> VAlign: <select id="VAlignSelect" runat="server"> <option value="Top">Top</option> <option value="Middle" selected>Middle</option> <option value="Bottom">Bottom</option> </select> <br><br> <input type="button" value="Generate Table" onserverclick="Button_Click" runat="server"/> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHtmlTableRow.Align プロパティを検索する場合は、下記のリンクをクリックしてください。

- HtmlTableRow.Align プロパティのページへのリンク