TableCaptionAlign 列舉

定義

指定呈現為 HTML 標題項目的文字水平或垂直放置。

public enum class TableCaptionAlign
public enum TableCaptionAlign
type TableCaptionAlign = 
Public Enum TableCaptionAlign
繼承
TableCaptionAlign

欄位

Bottom 2

標題項目與資料表底端對齊。

Left 3

標題項目與資料表左邊對齊。

NotSet 0

未設定標題對齊。 呈現標題的瀏覽器會決定標題的對齊位置。

Right 4

標題項目與資料表的右邊對齊。

Top 1

標題項目與資料表的頂端對齊。

範例

下列範例示範如何使用 TableCaptionAlign 列舉在 控制項中 Table 設定 CaptionAlign 屬性。 控制項 Table 包含 TableRow 顯示 City 和 ZIP Code 值的物件。

<%@ page language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>TableCaptionAlign Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <h3>TableCaptionAlign Enumeration Example</h3>
    <!-- Scope attribute added for accessibility -->
    <asp:table id="Table1" runat="server" CellPadding="4"
      caption="City Postal Codes" CellSpacing="1"
      captionalign="Right" gridlines="Both">
    <asp:TableRow>
      <asp:TableHeaderCell id="CityHeader" Scope="Column">
        City Name
      </asp:TableHeaderCell>
      <asp:TableHeaderCell id="ZipHeader" Scope="Column">
        ZIP Code
      </asp:TableHeaderCell>
    </asp:TableRow>
    <asp:TableRow>
      <asp:TableCell>
        Redmond
      </asp:TableCell>
      <asp:TableCell>
        98052
      </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
      <asp:TableCell>
        Albany
      </asp:TableCell>
      <asp:TableCell>
        12222
      </asp:TableCell>
    </asp:TableRow>
    </asp:table>

    </div>
    </form>
  </body>
</html>
<%@ page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>TableCaptionAlign Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <h3>TableCaptionAlign Enumeration Example</h3>
    <!-- Scope attribute added for accessibility -->
    <asp:table id="Table1" runat="server" CellPadding="4"
      caption="City Postal Codes" CellSpacing="1"
      captionalign="Right" gridlines="Both">
    <asp:TableRow>
      <asp:TableHeaderCell id="CityHeader" Scope="Column">
        City Name
      </asp:TableHeaderCell>
      <asp:TableHeaderCell id="ZipHeader" Scope="Column">
        ZIP Code
      </asp:TableHeaderCell>
    </asp:TableRow>
    <asp:TableRow>
      <asp:TableCell>
        Redmond
      </asp:TableCell>
      <asp:TableCell>
        98052
      </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
      <asp:TableCell>
        Albany
      </asp:TableCell>
      <asp:TableCell>
        12222
      </asp:TableCell>
    </asp:TableRow>
    </asp:table>

    </div>
    </form>
  </body>
</html>

備註

列舉 TableCaptionAlign 表示控制項中可以轉譯為數據表之 HTML 標題元素的水準或垂直位置,例如 TableGridViewDetailsViewCalendar 。 例如, CaptionAlign 屬性會使用這些列舉值來設定 控制項中的 Table 標題對齊方式。

如果您指定 NotSet,控制項轉譯所在的瀏覽器會決定要對齊標題的位置。

屬性 CaptionAlign 會指定標題專案相對於可轉譯為數據表的控制項位置。 屬性 Caption 會指定要顯示在 caption 元素中的文字。 輔助技術裝置可以使用 屬性所提供的 Caption 描述,讓控制項更容易存取。 例如,螢幕助讀程式裝置可能會向使用者讀取標題,以提供資料表的描述。

適用於

另請參閱