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

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

Align プロパティを使用して、HtmlTableCell クラスのインスタンスが表すセルの内容の水平方向の配置を指定します。
![]() |
---|
このプロパティを設定すると、HtmlTableCell クラスのインスタンスが表すセルにだけ影響します。テーブル内のすべての行のセルに同じ配置を適用するには、HtmlTableRow クラスのインスタンスによって表される行の Align プロパティを設定します。 |

Align プロパティを使用して、HtmlTable コントロールのセルの内容の配置をプログラムで制御するコード例を次に示します。
<%@ Page Language="VB" AutoEventWireup="True" %> <script runat="server"> Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs) Dim i As Integer Dim j As Integer ' Iterate through the rows of the table. For i = 0 To Table1.Rows.Count - 1 ' Iterate through the cells of a row. For j = 0 To Table1.Rows(i).Cells.Count - 1 ' Update the properties of each cell. Table1.Rows(i).Cells(j).Align = AlignSelect.Value Table1.Rows(i).Cells(j).NoWrap = Convert.ToBoolean(NoWrapSelect.Value) Table1.Rows(i).Cells(j).VAlign = VAlignSelect.Value Next j Next i End Sub </script> <html> <head> <title>HtmlTableCell Example</title> </head> <body> <form runat="server"> <h3>HtmlTableCell 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> NoWrap: <select id="NoWrapSelect" runat="server"> <option value="true">True</option> <option value="false" selected>False</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++) { // Iterate through the cells of a row. for (int j = 0; j <= Table1.Rows[i].Cells.Count - 1; j++) { // Update the properties of each cell. Table1.Rows[i].Cells[j].Align = AlignSelect.Value; Table1.Rows[i].Cells[j].NoWrap = Convert.ToBoolean(NoWrapSelect.Value); Table1.Rows[i].Cells[j].VAlign = VAlignSelect.Value; } } } </script> <html> <head> <title>HtmlTableCell Example</title> </head> <body> <form runat="server"> <h3>HtmlTableCell 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> NoWrap: <select id="NoWrapSelect" runat="server"> <option value="true">True</option> <option value="false" selected>False</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に収録されているすべての辞書からHtmlTableCell.Align プロパティを検索する場合は、下記のリンクをクリックしてください。

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