Calendar.TitleStyle プロパティ

Calendar コントロールのタイトル見出しのスタイル プロパティを取得します。

Public ReadOnly Property TitleStyle As TableItemStyle
[C#]
public TableItemStyle TitleStyle {get;}
[C++]
public: __property TableItemStyle* get_TitleStyle();
[JScript]
public function get TitleStyle() : TableItemStyle;

プロパティ値

Calendar コントロールのタイトル見出しのスタイル プロパティを格納している TableItemStyle 。既定値は空の TableItemStyle オブジェクトです。

解説

このプロパティを使用して、 Calendar コントロールのタイトル見出しのスタイルを指定します。制御できるさまざまなスタイル プロパティの詳細については、 TableItemStyle のトピックを参照してください。

TitleStyle プロパティは、 ShowTitle プロパティが true に設定されている場合にだけ適用されます。

使用例

[Visual Basic, C#, JScript] TitleStyle プロパティを使用して、 Calendar コントロールのタイトル見出しの背景色を青に、前景色を黄色に指定する方法を次の例に示します。

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

</head>
<body>

   <form runat="server">

      <h3>Calendar Example</h3>

      <asp:Calendar id="calendar1" runat="server">

         <TitleStyle BackColor="Blue" ForeColor="Yellow">
         </TitleStyle>

      </asp:Calendar> 
           
   </form>       

</body>
</html>


[C#] 
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>

</head>
<body>

   <form runat="server">

      <h3>Calendar Example</h3>

      <asp:Calendar id="calendar1" runat="server">

         <TitleStyle BackColor="Blue" ForeColor="Yellow">
         </TitleStyle>

      </asp:Calendar> 
           
   </form>       

</body>
</html>


[JScript] 
<%@ Page Language="JScript" AutoEventWireup="True" %>
<html>
<head>

</head>
<body>

   <form runat="server">

      <h3>Calendar Example</h3>

      <asp:Calendar id="calendar1" runat="server">

         <TitleStyle BackColor="Blue" ForeColor="Yellow">
         </TitleStyle>

      </asp:Calendar> 
           
   </form>       

</body>
</html>


[Visual Basic] 
<%@ Page Language="VB" AutoEventWireup="True" %>

<html>
   <script runat="server" >
  
      Sub Selection_Change(sender As Object, e As EventArgs)

         ' Set the background color for title section of the Calendar.
         Calendar1.TitleStyle.BackColor = _
            System.Drawing.Color.FromName(ColorList.SelectedItem.Value)

      End Sub
  
   </script>
  
<body>

   <form runat="server">
  
      <h3> Calendar TitleStyle Example </h3>

      Select a background color for the title section of the calendar.

      <br><br> 
  
      <asp:Calendar id="Calendar1"
           ShowGridLines="True" 
           ShowTitle="True"
           runat="server"/>

      <br><br>

      <table cellpadding="5">

         <tr>

            <td>

               Background color:

            </td>

         </tr>

         <tr>

            <td>

               <asp:DropDownList id="ColorList"
                    AutoPostBack="True"
                    OnSelectedIndexChanged="Selection_Change"
                    runat="server">

                  <asp:ListItem Value="White"> White </asp:ListItem>
                  <asp:ListItem Selected="True" Value="Silver"> Silver </asp:ListItem>
                  <asp:ListItem Value="DarkGray"> Dark Gray </asp:ListItem>
                  <asp:ListItem Value="Khaki"> Khaki </asp:ListItem>
                  <asp:ListItem Value="DarkKhaki"> Dark Khaki </asp:ListItem>

               </asp:DropDownList>

            </td>

         </tr>
  
   </form>

</body>
</html>
 

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

<html>
   <script runat="server" >
  
      void Selection_Change(Object sender, EventArgs e)
      {

         // Set the background color for the title section of the Calendar.
         Calendar1.TitleStyle.BackColor = 
            System.Drawing.Color.FromName(ColorList.SelectedItem.Value);

      }
  
   </script>
  
<body>

   <form runat="server">
  
      <h3> Calendar TitleStyle Example </h3>

      Select a background color for the title section of the calendar.

      <br><br> 
  
      <asp:Calendar id="Calendar1"
           ShowGridLines="True" 
           ShowTitle="True"
           runat="server"/>

      <br><br>

      <table cellpadding="5">

         <tr>

            <td>

               Background color:

            </td>

         </tr>

         <tr>

            <td>

               <asp:DropDownList id="ColorList"
                    AutoPostBack="True"
                    OnSelectedIndexChanged="Selection_Change"
                    runat="server">

                  <asp:ListItem Value="White"> White </asp:ListItem>
                  <asp:ListItem Selected="True" Value="Silver"> Silver </asp:ListItem>
                  <asp:ListItem Value="DarkGray"> Dark Gray </asp:ListItem>
                  <asp:ListItem Value="Khaki"> Khaki </asp:ListItem>
                  <asp:ListItem Value="DarkKhaki"> Dark Khaki </asp:ListItem>

               </asp:DropDownList>

            </td>

         </tr>
  
   </form>

</body>
</html>
 

[C++] C++ のサンプルはありません。Visual Basic、C#、および JScript のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ

参照

Calendar クラス | Calendar メンバ | System.Web.UI.WebControls 名前空間 | ShowTitle | TableItemStyle