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

/** @property */ public GridLines get_GridLines () /** @property */ public void set_GridLines (GridLines value)
GridLines 列挙値の 1 つ。既定値は None です。


GridLines プロパティを使用して、グリッド線スタイルを指定する方法を次の例に示します。
![]() |
---|
次のコード サンプルはシングルファイル コード モデルを使用しており、分離コード ファイルに直接コピーされた場合は正常に動作しない可能性があります。このコード サンプルは、拡張子が .aspx の空のテキスト ファイルにコピーする必要があります。Web フォームのコード モデルの詳細については、「ASP.NET Web ページのコード モデル」を参照してください。 |
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) ' Generate rows and cells. Dim numrows As Integer = 5 Dim numcells As Integer = 4 Dim i As Integer Dim j As Integer For j = 0 to numrows - 1 Dim r As TableRow = new TableRow() For i = 0 to numcells - 1 Dim c As TableCell = new TableCell() c.Controls.Add(New LiteralControl("row " & j.ToString() & _ ", cell " & i.ToString())) r.Cells.Add(c) Next i Table1.Rows.Add(r) Next j End Sub Sub Button_Click(sender As Object, e As EventArgs) Table1.GridLines = CType(DropDown1.SelectedIndex, GridLines) End Sub </script> </head> <body> <h3>Table GridLines Example</h3> <form runat="server"> <asp:Table id="Table1" BorderColor="black" BorderWidth="1" GridLines="Both" runat="server"/> <p> GridLines: <asp:DropDownList id="DropDown1" runat="server"> <asp:ListItem Value="0">None</asp:ListItem> <asp:ListItem Value="1">Horizontal</asp:ListItem> <asp:ListItem Value="2">Vertical</asp:ListItem> <asp:ListItem Value="3">Both</asp:ListItem> </asp:DropDownList> <br> <asp:button id="Button1" Text="Display Table" OnClick="Button_Click" runat=server/> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script runat="server"> void Page_Load(Object sender, EventArgs e) { // Generate rows and cells. int numrows = 5; int numcells = 4; for(int j=0; j<=numrows - 1; j++) { TableRow r = new TableRow(); for(int i=0; i <= numcells - 1; i++) { TableCell c = new TableCell(); c.Controls.Add(new LiteralControl("row " + j.ToString() + ", cell " + i.ToString())); r.Cells.Add(c); } Table1.Rows.Add(r); } } void Button_Click(Object sender, EventArgs e) { Table1.GridLines = (GridLines)DropDown1.SelectedIndex; } </script> </head> <body> <h3>Table GridLines Example</h3> <form runat="server"> <asp:Table id="Table1" BorderColor="black" BorderWidth="1" GridLines="Both" runat="server"/> <p> GridLines: <asp:DropDownList id="DropDown1" runat="server"> <asp:ListItem Value="0">None</asp:ListItem> <asp:ListItem Value="1">Horizontal</asp:ListItem> <asp:ListItem Value="2">Vertical</asp:ListItem> <asp:ListItem Value="3">Both</asp:ListItem> </asp:DropDownList> <br> <asp:button id="Button1" Text="Display Table" OnClick="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に収録されているすべての辞書からTable.GridLines プロパティを検索する場合は、下記のリンクをクリックしてください。

- Table.GridLines プロパティのページへのリンク