Calendar クラスとは? わかりやすく解説

Calendar クラス

週、月、年などの区分時間表します

名前空間: System.Globalization
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public MustInherit Class
 Calendar
    Implements ICloneable
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public abstract class Calendar : ICloneable
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public ref class Calendar abstract : ICloneable
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public abstract class Calendar implements ICloneable
SerializableAttribute 
ComVisibleAttribute(true) 
public abstract class Calendar implements ICloneable
解説解説

暦は、週、月、年などの単位時間分割します。区分の数、長さ、および開始点は、暦ごとに異なります

あらゆる瞬間を、特定の暦を使用して一連の数値で表すことができます。たとえば、グレゴリオ暦紀元 1999 年 3 月 20 日8:46:00:0.0 に発生した春分を (1999, 3, 20, 8, 46, 0, 0.0) のように表すことができますCalendar実装は、特定の暦の範囲内任意の日付類似の一連の数値割り当てることができますまた、DateTime は、Calendar と DateTimeFormatInfo から得られる情報使用して、その一連の数値テキスト表現割り当てることができますテキスト表現は、カルチャに依存するものもあれば (たとえば、英語 (米国) カルチャの "8:46 AM March 20th 1999 AD")、カルチャ非依存のものもあります (たとえば、ISO 8601 形式の "1999-03-20T08:46:00")。

Calendar 実装は、1 つ上の時代 (年号) を定義できますCalendar クラスは、現在の時代 (年号) (CurrentEra) の値が 0 の場合列挙整数として時代 (年号) を識別します。

地球実際に太陽周りを回る時間暦年との差、または月が実際に地球周りを回る時間暦年との差を埋めるために、閏年日数標準暦年日数異なってます。Calendar実装では、閏年の定義が異なります

一貫性のために、各間隔 (たとえば、最初の月) の最初単位には、値 1 が割り当てられます。

System.Globalization 名前空間には、GregorianCalendarHebrewCalendarHijriCalendarJapaneseCalendarJulianCalendarKoreanCalendar、TaiwanCalendar、ThaiBuddhistCalendar など、Calendar 実装あります

使用例使用例

Calendar クラスメンバ使用例次に示します

Imports System
Imports System.Globalization


Public Class SamplesCalendar   

   Public Shared Sub Main()

      ' Sets a DateTime to April 3, 2002 of the Gregorian calendar.
      Dim myDT As New DateTime(2002,
 4, 3, New GregorianCalendar())

      ' Uses the default calendar of the InvariantCulture.
      Dim myCal As Calendar = CultureInfo.InvariantCulture.Calendar

      ' Displays the values of the DateTime.
      Console.WriteLine("April 3, 2002 of the Gregorian calendar:")
      DisplayValues(myCal, myDT)

      ' Adds 5 to every component of the DateTime.
      myDT = myCal.AddYears(myDT, 5)
      myDT = myCal.AddMonths(myDT, 5)
      myDT = myCal.AddWeeks(myDT, 5)
      myDT = myCal.AddDays(myDT, 5)
      myDT = myCal.AddHours(myDT, 5)
      myDT = myCal.AddMinutes(myDT, 5)
      myDT = myCal.AddSeconds(myDT, 5)
      myDT = myCal.AddMilliseconds(myDT, 5)

      ' Displays the values of the DateTime.
      Console.WriteLine("After adding 5 to each component of the
 DateTime:")
      DisplayValues(myCal, myDT)

   End Sub 'Main

   Public Shared Sub DisplayValues(myCal
 As Calendar, myDT As DateTime)
      Console.WriteLine("   Era:          {0}", myCal.GetEra(myDT))
      Console.WriteLine("   Year:         {0}", myCal.GetYear(myDT))
      Console.WriteLine("   Month:        {0}", myCal.GetMonth(myDT))
      Console.WriteLine("   DayOfYear:    {0}", myCal.GetDayOfYear(myDT))
      Console.WriteLine("   DayOfMonth:   {0}", myCal.GetDayOfMonth(myDT))
      Console.WriteLine("   DayOfWeek:    {0}", myCal.GetDayOfWeek(myDT))
      Console.WriteLine("   Hour:         {0}", myCal.GetHour(myDT))
      Console.WriteLine("   Minute:       {0}", myCal.GetMinute(myDT))
      Console.WriteLine("   Second:       {0}", myCal.GetSecond(myDT))
      Console.WriteLine("   Milliseconds: {0}", myCal.GetMilliseconds(myDT))
      Console.WriteLine()
   End Sub 'DisplayValues

End Class 'SamplesCalendar 


'This code produces the following output.

'

'April 3, 2002 of the Gregorian calendar:

'   Era:          1

'   Year:         2002

'   Month:        4

'   DayOfYear:    93

'   DayOfMonth:   3

'   DayOfWeek:    Wednesday

'   Hour:         0

'   Minute:       0

'   Second:       0

'   Milliseconds: 0

'

'After adding 5 to each component of the DateTime:

'   Era:          1

'   Year:         2007

'   Month:        10

'   DayOfYear:    286

'   DayOfMonth:   13

'   DayOfWeek:    Saturday

'   Hour:         5

'   Minute:       5

'   Second:       5

'   Milliseconds: 5
using System;
using System.Globalization;


public class SamplesCalendar  {

   public static void Main()
  {

      // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
      DateTime myDT = new DateTime( 2002, 4, 3, new
 GregorianCalendar() );

      // Uses the default calendar of the InvariantCulture.
      Calendar myCal = CultureInfo.InvariantCulture.Calendar;

      // Displays the values of the DateTime.
      Console.WriteLine( "April 3, 2002 of the Gregorian calendar:" );
      DisplayValues( myCal, myDT );

      // Adds 5 to every component of the DateTime.
      myDT = myCal.AddYears( myDT, 5 );
      myDT = myCal.AddMonths( myDT, 5 );
      myDT = myCal.AddWeeks( myDT, 5 );
      myDT = myCal.AddDays( myDT, 5 );
      myDT = myCal.AddHours( myDT, 5 );
      myDT = myCal.AddMinutes( myDT, 5 );
      myDT = myCal.AddSeconds( myDT, 5 );
      myDT = myCal.AddMilliseconds( myDT, 5 );

      // Displays the values of the DateTime.
      Console.WriteLine( "After adding 5 to each component of the DateTime:"
 );
      DisplayValues( myCal, myDT );

   }

   public static void DisplayValues(
 Calendar myCal, DateTime myDT )  {
      Console.WriteLine( "   Era:          {0}", myCal.GetEra( myDT ) );
      Console.WriteLine( "   Year:         {0}", myCal.GetYear( myDT )
 );
      Console.WriteLine( "   Month:        {0}", myCal.GetMonth( myDT )
 );
      Console.WriteLine( "   DayOfYear:    {0}", myCal.GetDayOfYear( myDT
 ) );
      Console.WriteLine( "   DayOfMonth:   {0}", myCal.GetDayOfMonth( myDT
 ) );
      Console.WriteLine( "   DayOfWeek:    {0}", myCal.GetDayOfWeek( myDT
 ) );
      Console.WriteLine( "   Hour:         {0}", myCal.GetHour( myDT )
 );
      Console.WriteLine( "   Minute:       {0}", myCal.GetMinute( myDT
 ) );
      Console.WriteLine( "   Second:       {0}", myCal.GetSecond( myDT
 ) );
      Console.WriteLine( "   Milliseconds: {0}", myCal.GetMilliseconds(
 myDT ) );
      Console.WriteLine();
   }

}


/*
This code produces the following output.

April 3, 2002 of the Gregorian calendar:
   Era:          1
   Year:         2002
   Month:        4
   DayOfYear:    93
   DayOfMonth:   3
   DayOfWeek:    Wednesday
   Hour:         0
   Minute:       0
   Second:       0
   Milliseconds: 0

After adding 5 to each component of the DateTime:
   Era:          1
   Year:         2007
   Month:        10
   DayOfYear:    286
   DayOfMonth:   13
   DayOfWeek:    Saturday
   Hour:         5
   Minute:       5
   Second:       5
   Milliseconds: 5

*/
using namespace System;
using namespace System::Globalization;
void DisplayValues( Calendar^ myCal, DateTime myDT )
{
   Console::WriteLine( "   Era: {0}", myCal->GetEra( myDT ) );
   Console::WriteLine( "   Year: {0}", myCal->GetYear( myDT ) );
   Console::WriteLine( "   Month: {0}", myCal->GetMonth( myDT ) );
   Console::WriteLine( "   DayOfYear: {0}", myCal->GetDayOfYear( myDT
 ) );
   Console::WriteLine( "   DayOfMonth: {0}", myCal->GetDayOfMonth( myDT
 ) );
   Console::WriteLine( "   DayOfWeek: {0}", myCal->GetDayOfWeek( myDT
 ) );
   Console::WriteLine( "   Hour: {0}", myCal->GetHour( myDT ) );
   Console::WriteLine( "   Minute: {0}", myCal->GetMinute( myDT ) );
   Console::WriteLine( "   Second: {0}", myCal->GetSecond( myDT ) );
   Console::WriteLine( "   Milliseconds: {0}", myCal->GetMilliseconds(
 myDT ) );
   Console::WriteLine();
}

int main()
{
   
   // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
   DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar);
   
   // Uses the default calendar of the InvariantCulture.
   Calendar^ myCal = CultureInfo::InvariantCulture->Calendar;
   
   // Displays the values of the DateTime.
   Console::WriteLine( "April 3, 2002 of the Gregorian calendar:" );
   DisplayValues( myCal, myDT );
   
   // Adds 5 to every component of the DateTime.
   myDT = myCal->AddYears( myDT, 5 );
   myDT = myCal->AddMonths( myDT, 5 );
   myDT = myCal->AddWeeks( myDT, 5 );
   myDT = myCal->AddDays( myDT, 5 );
   myDT = myCal->AddHours( myDT, 5 );
   myDT = myCal->AddMinutes( myDT, 5 );
   myDT = myCal->AddSeconds( myDT, 5 );
   myDT = myCal->AddMilliseconds( myDT, 5 );
   
   // Displays the values of the DateTime.
   Console::WriteLine( "After adding 5 to each component of the DateTime:"
 );
   DisplayValues( myCal, myDT );
}

/*
This code produces the following output.

April 3, 2002 of the Gregorian calendar:
Era:          1
Year:         2002
Month:        4
DayOfYear:    93
DayOfMonth:   3
DayOfWeek:    Wednesday
Hour:         0
Minute:       0
Second:       0
Milliseconds: 0

After adding 5 to each component of the DateTime:
Era:          1
Year:         2007
Month:        10
DayOfYear:    286
DayOfMonth:   13
DayOfWeek:    Saturday
Hour:         5
Minute:       5
Second:       5
Milliseconds: 5

*/
import System.* ;
import System.Globalization.* ;

public class SamplesCalendar
{
    public static void main(String[]
 args)
    {
        // Sets a DateTime to April 3, 2002 of the Gregorian calendar.
        DateTime myDT =  new DateTime(2002, 4, 3, new
 GregorianCalendar());

        // Uses the default calendar of the InvariantCulture.
        Calendar myCal = CultureInfo.get_InvariantCulture().get_Calendar();

        // Displays the values of the DateTime.
        Console.WriteLine("April 3, 2002 of the Gregorian calendar:");
        DisplayValues(myCal, myDT);

        // Adds 5 to every component of the DateTime.
        myDT = myCal.AddYears(myDT, 5);
        myDT = myCal.AddMonths(myDT, 5);
        myDT = myCal.AddWeeks(myDT, 5);
        myDT = myCal.AddDays(myDT, 5);
        myDT = myCal.AddHours(myDT, 5);
        myDT = myCal.AddMinutes(myDT, 5);
        myDT = myCal.AddSeconds(myDT, 5);
        myDT = myCal.AddMilliseconds(myDT, 5);

        // Displays the values of the DateTime.
        Console.WriteLine("After adding 5 to each component of the DateTime:");
        DisplayValues(myCal, myDT);
    } //main
   
    public static void DisplayValues(Calendar
 myCal, DateTime myDT)
    {
        Console.WriteLine("   Era:          {0}", 
            System.Convert.ToString(myCal.GetEra(myDT)));
        Console.WriteLine("   Year:         {0}", 
            System.Convert.ToString(myCal.GetYear(myDT)));
        Console.WriteLine("   Month:        {0}", 
            System.Convert.ToString(myCal.GetMonth(myDT)));
        Console.WriteLine("   DayOfYear:    {0}", 
            System.Convert.ToString(myCal.GetDayOfYear(myDT)));
        Console.WriteLine("   DayOfMonth:   {0}", 
            System.Convert.ToString(myCal.GetDayOfMonth(myDT)));
        Console.WriteLine("   DayOfWeek:    {0}",
            System.Convert.ToString(myCal.GetDayOfWeek(myDT)));
        Console.WriteLine("   Hour:         {0}",
            System.Convert.ToString(myCal.GetHour(myDT)));
        Console.WriteLine("   Minute:       {0}",
            System.Convert.ToString(myCal.GetMinute(myDT)));
        Console.WriteLine("   Second:       {0}", 
            System.Convert.ToString(myCal.GetSecond(myDT)));
        Console.WriteLine("   Milliseconds: {0}", 
            System.Convert.ToString(myCal.GetMilliseconds(myDT)));
        Console.WriteLine();
    } //DisplayValues
} //SamplesCalendar

/*
This code produces the following output.

April 3, 2002 of the Gregorian calendar:
   Era:          1
   Year:         2002
   Month:        4
   DayOfYear:    93
   DayOfMonth:   3
   DayOfWeek:    Wednesday
   Hour:         0
   Minute:       0
   Second:       0
   Milliseconds: 0

After adding 5 to each component of the DateTime:
   Era:          1
   Year:         2007
   Month:        10
   DayOfYear:    286
   DayOfMonth:   13
   DayOfWeek:    Saturday
   Hour:         5
   Minute:       5
   Second:       5
   Milliseconds: 5
*/
継承階層継承階層
System.Object
  System.Globalization.Calendar
     派生クラス
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Calendar クラス

カレンダー表示するコントロール機能提供します

名前空間: System.Web.UI.MobileControls
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)
構文構文

Public Class Calendar
    Inherits MobileControl
    Implements IPostBackEventHandler
public class Calendar : MobileControl, IPostBackEventHandler
public ref class Calendar : public
 MobileControl, IPostBackEventHandler
public class Calendar extends MobileControl
 implements IPostBackEventHandler
public class Calendar extends
 MobileControl implements IPostBackEventHandler
解説解説
使用例使用例

次のコード例には、ページ読み込みコード ブロックに SelectionMode プロパティ記述して、日、週、月ごとに期間を選択する方法示されています。この例では、Calendar クラスの BorderStyle プロパティおよび BackColor プロパティ設定しユーザー選択識別します。

メモメモ

次のコード サンプルはシングルファイル コード モデル使用しており、分離コード ファイル直接コピーされ場合正常に動作しない可能性あります。このコード サンプルは、拡張子.aspx の空のテキスト ファイルコピーする必要があります詳細については、「ASP.NET Web ページコード モデル」を参照してください

<%@ Page Language="VB"
    Inherits="System.Web.UI.MobileControls.MobilePage"
 %>
<%@ Import Namespace="System.Drawing"
 %>
<%@ Import Namespace="System.Web.UI.WebControls"
 %>
<%@ Register TagPrefix="mobile"
    Namespace="System.Web.UI.MobileControls"
    Assembly="System.Web.Mobile"
 %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<script runat="server">
       
    Protected Sub Page_Load(ByVal
 sender As Object, _
        ByVal e As System.EventArgs) Handles
 Me.Load

        ' Display the day header
        Calendar1.ShowDayHeader = True

        ' Allow the user to select a week or a month at a time.
        Calendar1.SelectionMode = _
            CalendarSelectionMode.DayWeekMonth

        ' Set the BorderStyle and BorderColor properties.
        Calendar1.WebCalendar.DayStyle.BorderStyle = _
            BorderStyle.Solid
        Calendar1.WebCalendar.DayStyle.BorderColor = Color.Cyan

        Calendar1.CalendarEntryText = "Your birthdate"
        Calendar1.FirstDayOfWeek = _
            System.Web.UI.WebControls.FirstDayOfWeek.Friday
        
        Calendar1.VisibleDate = DateTime.Parse("7/1/2004")

    End Sub

    Protected Sub ShowChanges(ByVal
 sender As Object, _
        ByVal e As EventArgs)

        TextView1.Text = "The date you selected is "
 & _
           Calendar1.SelectedDate.ToShortDateString()

        ' Distinguish the selected block using colors.
        Calendar1.WebCalendar.SelectedDayStyle.BackColor = _
            Color.LightGreen
        Calendar1.WebCalendar.SelectedDayStyle.BorderColor = _
            Color.Gray
        Calendar1.WebCalendar.DayStyle.BorderColor = Color.Blue
    End Sub

    Protected Sub Command1_Click(ByVal
 sender As Object, ByVal
 e As System.EventArgs)
        Dim currentDay As Integer
 = Calendar1.VisibleDate.Day
        Dim currentMonth As Integer
 = Calendar1.VisibleDate.Month
        Dim currentYear As Integer
 = Calendar1.VisibleDate.Year
        Calendar1.SelectedDates.Clear()
        
        ' Loop through current month and add all Wednesdays to the collection.
        Dim i As Integer
        For i = 1 To System.DateTime.DaysInMonth(currentYear,
 currentMonth)
            Dim targetDate As New
 DateTime(currentYear, currentMonth, i)
            If targetDate.DayOfWeek = DayOfWeek.Wednesday Then
                Calendar1.SelectedDates.Add(targetDate)
            End If
        Next i
        TextView1.Text = "Selection Count = " &
 Calendar1.SelectedDates.Count.ToString()
    End Sub
</script>

<html  >
<body>
    <mobile:form id="form1" runat="server">
        <mobile:Calendar id="Calendar1" runat="server"
            OnSelectionChanged="ShowChanges" />
        <mobile:TextView runat="server" id="TextView1"
 />
        <mobile:Command ID="Command1" OnClick="Command1_Click"
 Runat="server">Select Weekdays</mobile:Command>
    </mobile:form>
</body>
</html>
<%@ Page Language="C#" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<script runat="server">
    protected void Page_Load(object sender,
 EventArgs e)
    {
        // Display the day header
        Calendar1.ShowDayHeader = true;
        
        // This allows the user to select a week or a month at a time.
        Calendar1.SelectionMode =
           CalendarSelectionMode.DayWeekMonth;
        // Set the BorderStyle and BorderColor properties.
        Calendar1.WebCalendar.DayStyle.BorderStyle =
           BorderStyle.Solid;
        Calendar1.WebCalendar.DayStyle.BorderColor = Color.Cyan;

        Calendar1.CalendarEntryText = "Your birthdate";
        
        Calendar1.VisibleDate = DateTime.Parse("7/1/" + 
            DateTime.Now.Year.ToString());
    }

    protected void ShowChanges(Object sender,
 EventArgs e)
    {
        TextView1.Text = "The date you selected is " +
           Calendar1.SelectedDate.ToShortDateString();
        
        // Distinguish the selected block using colors.
        Calendar1.WebCalendar.SelectedDayStyle.BackColor =
           Color.LightGreen;
        Calendar1.WebCalendar.SelectedDayStyle.BorderColor =
           Color.Gray;
        Calendar1.WebCalendar.DayStyle.BorderColor = Color.Blue;
    }

    protected void Command1_Click(object sender,
 EventArgs e)
    {
        int currentDay = Calendar1.VisibleDate.Day;
        int currentMonth = Calendar1.VisibleDate.Month;
        int currentYear = Calendar1.VisibleDate.Year;
        Calendar1.SelectedDates.Clear();

        // Add all Wednesdays to the collection.
        for (int i = 1; i <= System.DateTime.DaysInMonth(currentYear
,
               currentMonth); i++)
        {
            DateTime targetDate = new DateTime(currentYear, currentMonth,
 i);
            if (targetDate.DayOfWeek == DayOfWeek.Wednesday)
                Calendar1.SelectedDates.Add(targetDate);
        }
        TextView1.Text = "Selection Count ="
           + Calendar1.SelectedDates.Count.ToString();
    }
</script>

<html  >
<body>
    <mobile:form id="form1" runat="server">
        <mobile:Calendar id="Calendar1" runat="server"
            OnSelectionChanged="ShowChanges" />
        <mobile:TextView runat="server" id="TextView1" />
        <mobile:Command ID="Command1" OnClick="Command1_Click"
 
            Runat="server">Select Wednesdays</mobile:Command>
    </mobile:form>
</body>
</html>
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.MobileControls.MobileControl
      System.Web.UI.MobileControls.Calendar
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

Calendar クラス

1 つの月の月間カレンダー表示しますユーザーはこのカレンダー日付選択し前後の月に移動できます

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

<ControlValuePropertyAttribute("SelectedDate",
 GetType(DateTime), "1/1/0001")>
 _
Public Class Calendar
    Inherits WebControl
    Implements IPostBackEventHandler
[ControlValuePropertyAttribute("SelectedDate", typeof(DateTime), "1/1/0001")]
 
public class Calendar : WebControl, IPostBackEventHandler
[ControlValuePropertyAttribute(L"SelectedDate", typeof(DateTime), L"1/1/0001")]
 
public ref class Calendar : public
 WebControl, IPostBackEventHandler
/** @attribute ControlValuePropertyAttribute("SelectedDate", System.DateTime,
 "1/1/0001") */ 
public class Calendar extends WebControl implements
 IPostBackEventHandler
ControlValuePropertyAttribute("SelectedDate", System.DateTime, "1/1/0001")
 
public class Calendar extends
 WebControl implements IPostBackEventHandler
解説解説

Calendar コントロール使用してWeb ページ1 つ月間カレンダー表示します。このコントロールにより日付選択し前後の月に移動できますCalendar コントロールは、System.Globalization 名前空間内のすべての System.Globalization.Calendar 型をサポートしますサポート対象には、グレゴリオ暦の他、回教暦などの年月周期異なる暦も含まれています。

SelectionMode プロパティ設定することにより、Calendar コントロール1 つ日付1 つの週、または 1 つの月を選択できます

既定では、コントロールはその月の日付曜日月名付いたタイトル表示し、月のそれぞれの日付移動するリンク、および前後の月に移動するリンクを用意しますCalendar コントロール異なった部分制御するプロパティ設定することにより、このコントロール外観カスタマイズできますコントロール異なった部分スタイル指定するプロパティ一覧表次に示します

コントロールさまざまな部分表示または非表示にすることもできます表示または非表示にする部分制御するプロパティの一覧を次の表に示します

プロパティ

説明

ShowDayHeader

曜日を示すセクション表示または非表示にします。

ShowGridLines

月の日付の間のグリッド線表示または非表示にします。

ShowNextPrevMonth

前後の月へのナビゲーション コントロール表示または非表示にします。

ShowTitle

タイトル セクション表示または非表示にします。

Calendar コントロールについてはデータ ソースへの連結サポートされていませんが、それぞれの日付セル内容と書式は変更できますCalendar コントロールは、Web ページ表示される前に構成要素であるコンポーネント作成してアセンブルます。DayRender イベントは、Calendar コントロール各日セル作成されるときに発生しますDayRender イベントイベント ハンドラコード記述して作成時に日付セル内容と書式を制御できます日付セル内容カスタマイズする方法詳細については、OnDayRender のトピック参照してください

ユーザー補助

TopicLocation
チュートリアル : Visual Web Developer での ASP.NET マスタ ページ作成使用Visual Studio での ASP .NET Web アプリケーション作成
チュートリアル : Visual Web Developer での基本的な Web ページ作成Visual Studio での ASP .NET Web アプリケーション作成
チュートリアル : カスタム ビジネス オブジェクトへのデータ バインディングVisual Studio での ASP .NET Web アプリケーション作成
チュートリアル : テーマ使用した Web サイトカスタマイズVisual Studio での ASP .NET Web アプリケーション作成
方法 : Calendar Web サーバー コントロール選択され日付読み取るASP .NET Web アプリケーション作成
方法 : Calendar Web サーバー コントロールにおけるユーザー日付選択制御するASP .NET Web アプリケーション作成
方法 : Calendar Web サーバー コントロールにおける日付選択応答するASP .NET Web アプリケーション作成
方法 : Calendar Web サーバー コントロールにおける日単位カスタマイズASP .NET Web アプリケーション作成
方法 : Calendar Web サーバー コントロールにおける表示月の移動制御するASP .NET Web アプリケーション作成
方法 : Calendar Web サーバー コントロール今日の日付をプログラム設定するASP .NET Web アプリケーション作成
方法 : Calendar Web サーバー コントロール表示形式カスタマイズするASP .NET Web アプリケーション作成
方法 : スタイル使用してCalendar Web サーバー コントロール要素表示形式指定するASP .NET Web アプリケーション作成
方法 : データベース選択した日付Calendar コントロール表示するASP .NET Web アプリケーション作成
使用例使用例

Web ページCalendar コントロール作成する方法次のコード例示します

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

</head>
<body>

   <form runat="server">

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

           <OtherMonthDayStyle ForeColor="LightGray">
           </OtherMonthDayStyle>

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

           <DayStyle BackColor="gray">
           </DayStyle>

           <SelectedDayStyle BackColor="LightGray"
                             Font-Bold="True">
           </SelectedDayStyle>

      </asp:Calendar>
            
   </form>
        
</body>
</html>
   
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>

</head>
<body>

   <form runat="server">

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

           <OtherMonthDayStyle ForeColor="LightGray">
           </OtherMonthDayStyle>

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

           <DayStyle BackColor="gray">
           </DayStyle>

           <SelectedDayStyle BackColor="LightGray"
                             Font-Bold="True">
           </SelectedDayStyle>

      </asp:Calendar>
            
   </form>
        
</body>
</html>
   
<%@ Page Language="JScript" AutoEventWireup="True" %>
<html>
<head>

</head>
<body>

   <form runat="server">

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

           <OtherMonthDayStyle ForeColor="LightGray">
           </OtherMonthDayStyle>

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

           <DayStyle BackColor="gray">
           </DayStyle>

           <SelectedDayStyle BackColor="LightGray"
                             Font-Bold="True">
           </SelectedDayStyle>

      </asp:Calendar>
            
   </form>
        
</body>
</html>
   
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
      System.Web.UI.WebControls.Calendar
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Calendar メンバ
System.Web.UI.WebControls 名前空間
SelectionMode
DayHeaderStyle
DayStyle
NextPrevStyle
OtherMonthDayStyle
SelectedDayStyle
SelectorStyle
TitleStyle
TodayDayStyle
WeekendDayStyle
ShowDayHeader
ShowGridLines
ShowNextPrevMonth
ShowTitle
その他の技術情報
ASP.NET Web ページクライアント スクリプト
Calendar Web サーバー コントロール



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Calendar クラス」の関連用語

Calendar クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Calendar クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS