TableCaptionAlign 列舉

定義

指定呈現為 HTML 標題項目的文字水平或垂直放置。Specifies the horizontal or vertical placement of the text to render as the HTML caption element.

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

欄位

Bottom 2

標題項目與資料表底端對齊。The caption element is aligned with the bottom of the table.

Left 3

標題項目與資料表左邊對齊。The caption element is aligned with the left side of the table.

NotSet 0

未設定標題對齊。The caption alignment is not set. 呈現標題的瀏覽器會決定標題的對齊位置。The browser that renders the caption determines where to align the caption.

Right 4

標題項目與資料表的右邊對齊。The caption element is aligned with the right side of the table.

Top 1

標題項目與資料表的頂端對齊。The caption element is aligned with the top of the table.

範例

下列範例示範如何使用 TableCaptionAlign 列舉來設定 CaptionAlign 控制項中的屬性 TableThe following example demonstrates how to use the TableCaptionAlign enumeration to set the CaptionAlign property in a Table control. Table控制項包含 TableRow 會顯示城市和郵遞區號值的物件。The Table control contains TableRow objects that display City and ZIP Code values.

<%@ 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 enumeration)代表可轉譯為數據表之控制項中 HTML caption 元素的水準或垂直位置,例如 TableGridViewDetailsViewCalendarThe TableCaptionAlign enumeration represents the horizontal or vertical placement of the HTML caption element in controls that can be rendered as tables, such as Table, GridView, DetailsView, or Calendar. 例如,屬性會 CaptionAlign 使用這些列舉值來設定控制項中的標題對齊 TableFor example, the CaptionAlign property uses these enumeration values to set the caption alignment in a Table control.

如果您指定 NotSet,呈現控制項的瀏覽器會決定要對齊標題的位置。If you specify NotSet, the browser in which the control is rendered determines where to align the caption.

CaptionAlign屬性會指定標題元素相對於可轉譯為數據表之控制項的位置。The CaptionAlign property specifies the position of the caption element with respect to controls that can be rendered as tables. Caption屬性會指定要顯示在 caption 元素中的文字。The Caption property specifies the text to display in the caption element. 輔助技術裝置可以使用屬性所提供的描述 Caption ,讓控制項更容易存取。Assistive technology devices can use the description provided by the Caption property to make the control more accessible. 例如,螢幕讀取器裝置可能會讀取使用者的標題,以提供資料表的描述。For example, a screen reader device might read the caption to the user to provide them with a description of the table.

適用於

另請參閱