Calendar.CaptionAlign 属性  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置呈现为日历标题的文本的对齐方式。
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, setPublic Overridable Property CaptionAlign As 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 | 标题显示在日历顶部,文本居中。 |