Calendar.CaptionAlign 屬性

定義

取得或設定呈現為月曆標題之文字的對齊方式。

public:
 virtual property System::Web::UI::WebControls::TableCaptionAlign CaptionAlign { System::Web::UI::WebControls::TableCaptionAlign get(); void set(System::Web::UI::WebControls::TableCaptionAlign value); };
public virtual System.Web.UI.WebControls.TableCaptionAlign CaptionAlign { get; set; }
member this.CaptionAlign : System.Web.UI.WebControls.TableCaptionAlign with get, set
Public Overridable Property CaptionAlign As TableCaptionAlign

屬性值

TableCaptionAlign

TableCaptionAlign 值,表示標題的對齊方式。

例外狀況

指定的值不是其中一個 TableCaptionAlign 值。

範例

下列程式碼範例示範如何使用 CaptionAlign 屬性來對齊控制項的 Calendar 標題。

<%@ Page Language="C#" AutoEventWireup="True" %>

<!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 runat="server">
    <title> Calendar Caption and Caption Align Example </title>
</head>
<body>

   <form id="form1" runat="server">
  
      <h3> Calendar Caption and Caption Align Example </h3>

      <br /><br /> 
  
      <asp:Calendar id="Calendar1"
           ShowGridLines="True" 
           ShowTitle="True"
            Caption="This calendar is used to demonstrate a calendar caption. It also shows
            how the caption can be aligned to the calendar, in this case to the right edge of
            the calendar."
            CaptionAlign="right"  
           runat="server"/>

      <br /><br />

   </form>

</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>

<!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 runat="server">
    <title> Calendar Caption and Caption Align Example </title>
</head>
<body>

   <form id="form1" runat="server">
  
      <h3> Calendar Caption and Caption Align Example </h3>

      <br /><br /> 
  
      <asp:Calendar id="Calendar1"
           ShowGridLines="True" 
           ShowTitle="True"
            Caption="This calendar is used to demonstrate a calendar caption. It also shows
            how the caption can be aligned to the calendar, in this case to the right edge of
            the calendar."
            CaptionAlign="right"  
           runat="server"/>

      <br /><br />

   </form>

</body>
</html>

備註

這個屬性會決定標題相對於 Calendar 控制項出現的位置。 預設值為 NotSet ,可讓瀏覽器判斷要對齊標題的位置。 下表說明值與標題外觀之間的 TableCaptionAlign 關聯性。

TableCaptionAlign 外觀
Bottom 標題會顯示在行事曆底部,並置中文字。
Left 標題會顯示在行事曆頂端,文字靠左對齊。
NotSet 標題對齊未設定,而且是由瀏覽器決定。
Right 標題會出現在行事曆頂端,文字靠右對齊。
Top 標題會顯示在行事曆頂端,並置中文字。

適用於

另請參閱