Calendar.TodayDayStyle プロパティ
アセンブリ: System.Web (system.web.dll 内)
構文
Calendar コントロールの今日の日付のスタイル プロパティを格納している TableItemStyle。既定値は空の TableItemStyle です。
このプロパティを使用して、Calendar コントロールの今日の日付のスタイルを指定します。TodayDayStyle プロパティが設定されていない場合は、DayStyle プロパティで指定したスタイルが使用されます。
TodayDayStyle プロパティを使用して、今日の日付の背景色を青に、前景色を黄色に指定する方法を次のコード例に示します。
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> </head> <body> <form runat="server"> <h3>Calendar Example</h3> <asp:Calendar id="calendar1" runat="server"> <TodayDayStyle BackColor="Blue" ForeColor="Yellow"> </TodayDayStyle> </asp:Calendar> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> </head> <body> <form runat="server"> <h3>Calendar Example</h3> <asp:Calendar id="calendar1" runat="server"> <TodayDayStyle BackColor="Blue" ForeColor="Yellow"> </TodayDayStyle> </asp:Calendar> </form> </body> </html>
<%@ Page Language="JScript" AutoEventWireup="True" %> <html> <head> </head> <body> <form runat="server"> <h3>Calendar Example</h3> <asp:Calendar id="calendar1" runat="server"> <TodayDayStyle BackColor="Blue" ForeColor="Yellow"> </TodayDayStyle> </asp:Calendar> </form> </body> </html>
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <script runat="server" > Sub Selection_Change(sender As Object, e As EventArgs) ' Set the background color for today's date in the Calendar. Calendar1.TodayDayStyle.BackColor = _ System.Drawing.Color.FromName(ColorList.SelectedItem.Value) End Sub </script> <body> <form runat="server"> <h3> Calendar TodayDayStyle Example </h3> Select a background color for today's date in 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 Selected="True" Value="White"> White </asp:ListItem> <asp:ListItem 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>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <script runat="server" > void Selection_Change(Object sender, EventArgs e) { // Set the background color for today's date in the Calendar. Calendar1.TodayDayStyle.BackColor = System.Drawing.Color.FromName(ColorList.SelectedItem.Value); } </script> <body> <form runat="server"> <h3> Calendar TodayDayStyle Example </h3> Select a background color for today's date in 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 Selected="True" Value="White"> White </asp:ListItem> <asp:ListItem 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>
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
Weblioに収録されているすべての辞書からCalendar.TodayDayStyle プロパティを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からCalendar.TodayDayStyle プロパティ を検索
- Calendar.TodayDayStyle プロパティのページへのリンク