MonthCalendar.DateChanged イベントとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > MonthCalendar.DateChanged イベントの意味・解説 

MonthCalendar.DateChanged イベント

MonthCalendar で選択され日付変更され場合発生します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Event DateChanged As
 DateRangeEventHandler
Dim instance As MonthCalendar
Dim handler As DateRangeEventHandler

AddHandler instance.DateChanged, handler
public event DateRangeEventHandler DateChanged
public:
event DateRangeEventHandler^ DateChanged {
    void add (DateRangeEventHandler^ value);
    void remove (DateRangeEventHandler^ value);
}
/** @event */
public void add_DateChanged (DateRangeEventHandler
 value)

/** @event */
public void remove_DateChanged (DateRangeEventHandler
 value)
JScript では、イベント使用できますが、新規に宣言することはできません。
解説解説
使用例使用例

SelectionRange を作成し、その Start プロパティEnd プロパティ設定しSelectionRangeMonthCalendar コントロールの SelectionRange プロパティ割り当てるコード例次に示しますDateChanged イベント発生すると、Start プロパティおよび End プロパティの値がテキスト ボックス表示されます。この例は、2 つTextBox コントロールButton コントロール、および MonthCalendar コントロール配置されForm があることを前提にしています。

Private Sub button1_Click(sender As
 Object, _
  e As EventArgs) Handles button1.Click
   ' Create a SelectionRange object and set its Start and End properties.
   Dim sr As New SelectionRange()
   sr.Start = DateTime.Parse(Me.textBox1.Text)
   sr.End = DateTime.Parse(Me.textBox2.Text)
   ' Assign the SelectionRange object to the
   ' SelectionRange property of the MonthCalendar control. 
   Me.monthCalendar1.SelectionRange = sr
End Sub 


Private Sub monthCalendar1_DateChanged(sender
 As Object, _
  e As DateRangeEventArgs) Handles monthCalendar1.DateChanged
   ' Display the Start and End property values of
   ' the SelectionRange object in the text boxes. 
   Me.textBox1.Text = monthCalendar1.SelectionRange.Start.Date.ToShortDateString()
   Me.textBox2.Text = monthCalendar1.SelectionRange.End.Date.ToShortDateString()
End Sub
private void button1_Click(object sender, System.EventArgs
 e)
{
   // Create a SelectionRange object and set its Start and End properties.
   SelectionRange sr = new SelectionRange();
   sr.Start = DateTime.Parse(this.textBox1.Text);
   sr.End = DateTime.Parse(this.textBox2.Text);
   /* Assign the SelectionRange object to the 
      SelectionRange property of the MonthCalendar control. */
   this.monthCalendar1.SelectionRange = sr;
}

private void monthCalendar1_DateChanged(object
 sender, DateRangeEventArgs e)
{
   /* Display the Start and End property values of 
      the SelectionRange object in the text boxes. */
   this.textBox1.Text = 
     monthCalendar1.SelectionRange.Start.Date.ToShortDateString();
   this.textBox2.Text = 
     monthCalendar1.SelectionRange.End.Date.ToShortDateString();
}
private:
   void button1_Click( Object^ /*sender*/, System::EventArgs^
 /*e*/ )
   {
      // Create a SelectionRange object and set its Start and End properties.
      SelectionRange^ sr = gcnew SelectionRange;
      sr->Start = DateTime::Parse( this->textBox1->Text
 );
      sr->End = DateTime::Parse( this->textBox2->Text
 );
      
      /* Assign the SelectionRange object to the
            SelectionRange property of the MonthCalendar control. */
      this->monthCalendar1->SelectionRange = sr;
   }

   void monthCalendar1_DateChanged( Object^ /*sender*/, DateRangeEventArgs^
 /*e*/ )
   {
      /* Display the Start and End property values of
            the SelectionRange object in the text boxes. */
      this->textBox1->Text = monthCalendar1->SelectionRange->Start.Date.ToShortDateString();
      this->textBox2->Text = monthCalendar1->SelectionRange->End.Date.ToShortDateString();
   }
private void button1_Click(Object sender, System.EventArgs
 e)
{
    // Create a SelectionRange object and set its Start and End properties.
    SelectionRange sr = new SelectionRange();
    sr.set_Start(DateTime.Parse(this.textBox1.get_Text()));
    sr.set_End(DateTime.Parse(this.textBox2.get_Text()));

    /* Assign the SelectionRange object to the 
       SelectionRange property of the MonthCalendar control. */
    this.monthCalendar1.set_SelectionRange(sr);
} //button1_Click

private void monthCalendar1_DateChanged(Object
 sender, DateRangeEventArgs e)
{
    /* Display the Start and End property values of 
       the SelectionRange object in the text boxes. */
    this.textBox1.set_Text(monthCalendar1.get_SelectionRange().get_Start().
        get_Date().ToShortDateString());
    this.textBox2.set_Text(monthCalendar1.get_SelectionRange().get_End().
        get_Date().ToShortDateString());
} //monthCalendar1_DateChanged

1 暦年表示する MonthCalendar コントロール配置されフォーム表示するコード例次に示しますBackColor、ForeColor、TitleBackColor、TitleForeColor、CalendarDimensions、TrailingForeColor の各プロパティ設定して予定表コントロール外観カスタマイズする例を次に示しますその他のプロパティ、たとえば AnnuallyBoldedDates、BoldedDates、および MonthlyBoldedDates は、どの日付太字にするかをカスタマイズするために設定されます。また、予定表形式変更するために、FirstDayOfWeek、MaxDate、MinDate、MaxSelectionCount の各プロパティ設定しますDateSelected イベントおよび DateChanged イベント処理されステータスフォーム表示されます。

Imports System
Imports System.Drawing
Imports System.Windows.Forms

Public NotInheritable Class
 Form1
    Inherits System.Windows.Forms.Form

    Friend WithEvents MonthCalendar1 As
 System.Windows.Forms.MonthCalendar
    Friend WithEvents TextBox1 As
 System.Windows.Forms.TextBox

    <System.STAThread()> _
    Public Shared Sub Main()
        System.Windows.Forms.Application.Run(New Form1)
    End Sub 'Main

    Public Sub New()
        MyBase.New()

        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.TextBox1.Location = New System.Drawing.Point(48,
 488)
        Me.TextBox1.Multiline = True
        Me.TextBox1.ReadOnly = True
        Me.TextBox1.Size = New System.Drawing.Size(824,
 32)

        ' Create the calendar.
        Me.MonthCalendar1 = New System.Windows.Forms.MonthCalendar

        ' Set the calendar location.
        Me.MonthCalendar1.Location = New System.Drawing.Point(47,
 16)

        ' Change the color.
        Me.MonthCalendar1.BackColor = System.Drawing.SystemColors.Info
        Me.MonthCalendar1.ForeColor = System.Drawing.Color.FromArgb(
 _
                                CType(192, System.Byte), CType(0, System.Byte), CType(192,
 System.Byte))
        Me.MonthCalendar1.TitleBackColor = System.Drawing.Color.Purple
        Me.MonthCalendar1.TitleForeColor = System.Drawing.Color.Yellow
        Me.MonthCalendar1.TrailingForeColor = System.Drawing.Color.FromArgb(
 _
                                CType(192, System.Byte), CType(192, System.Byte),
 CType(0, System.Byte))

        ' Add dates to the AnnuallyBoldedDates array.
        Me.MonthCalendar1.AnnuallyBoldedDates = New
 System.DateTime() _
                     {New System.DateTime(2002, 4, 20, 0, 0, 0, 0), _
                      New System.DateTime(2002, 4, 28, 0, 0, 0,
 0), _
                      New System.DateTime(2002, 5, 5, 0, 0, 0,
 0), _
                      New System.DateTime(2002, 7, 4, 0, 0, 0,
 0), _
                      New System.DateTime(2002, 12, 15, 0, 0,
 0, 0), _ 
                      New System.DateTime(2002, 12, 18, 0, 0,
 0, 0)}

        ' Add dates to BoldedDates array.
        Me.MonthCalendar1.BoldedDates = New
 System.DateTime() {New System.DateTime(2002, 9, 26, 0, 0, 0, 0)}

        ' Add dates to MonthlyBoldedDates array.
        Me.MonthCalendar1.MonthlyBoldedDates = New
 System.DateTime() _
                     {New System.DateTime(2002, 1, 15, 0, 0, 0, 0), _
                      New System.DateTime(2002, 1, 30, 0, 0, 0,
 0)}

        ' Configure the calendar to display 3 rows by 4 columns of months.
        Me.MonthCalendar1.CalendarDimensions = New
 System.Drawing.Size(4, 3)

        ' Set the week to begin on Monday.
        Me.MonthCalendar1.FirstDayOfWeek = System.Windows.Forms.Day.Monday

        ' Sets the maximum visible date on the calendar to 12/31/2010.
        Me.MonthCalendar1.MaxDate = New System.DateTime(2010,
 12, 31, 0, 0, 0, 0)

        ' Set the minimum visible date on the calendar to 12/31/2010.
        Me.MonthCalendar1.MinDate = New System.DateTime(1999,
 1, 1, 0, 0, 0, 0)

        ' Only allow 21 days to be selected at the same time.
        Me.MonthCalendar1.MaxSelectionCount = 21

        ' Set the calendar to move one month at a time when navigating
 using the arrows.
        Me.MonthCalendar1.ScrollChange = 1

        ' Do not show the "Today" banner.
        Me.MonthCalendar1.ShowToday = False

        ' Do not circle today's date.
        Me.MonthCalendar1.ShowTodayCircle = False

        ' Show the week numbers to the left of each week.
        Me.MonthCalendar1.ShowWeekNumbers = True

        ' Set up how the form should be displayed and add the controls
 to the form.
        Me.ClientSize = New System.Drawing.Size(920,
 566)
        Me.Controls.AddRange(New System.Windows.Forms.Control()
 {Me.TextBox1, Me.MonthCalendar1})
        Me.Text = "Month Calendar Example"

    End Sub

    Private Sub monthCalendar1_DateSelected(ByVal
 sender As Object, _
                    ByVal e As System.Windows.Forms.DateRangeEventArgs)
 Handles MonthCalendar1.DateSelected

        ' Show the start and end dates in the text box.
        Me.TextBox1.Text = "Date Selected:
 Start = " + _
                e.Start.ToShortDateString() + " : End = "
 + e.End.ToShortDateString()
    End Sub

    Private Sub monthCalendar1_DateChanged(ByVal
 sender As Object, _
                    ByVal e As System.Windows.Forms.DateRangeEventArgs)
 Handles MonthCalendar1.DateChanged

        ' Show the start and end dates in the text box.
        Me.TextBox1.Text = "Date Changed: Start
 = " + _
                e.Start.ToShortDateString() + " : End = "
 + e.End.ToShortDateString()
    End Sub
End Class
using System;
using System.Drawing;
using System.Windows.Forms;

public class Form1 : System.Windows.Forms.Form
{
    private System.Windows.Forms.MonthCalendar monthCalendar1;
    private System.Windows.Forms.TextBox textBox1;

    [STAThread]
    static void Main() 
    {
        Application.Run(new Form1());
    }

    public Form1()
    {
        this.textBox1 = new System.Windows.Forms.TextBox();
        this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.textBox1.Location = new System.Drawing.Point(48,
 488);
        this.textBox1.Multiline = true;
        this.textBox1.ReadOnly = true;
        this.textBox1.Size = new System.Drawing.Size(824,
 32);

        // Create the calendar.
        this.monthCalendar1 = new System.Windows.Forms.MonthCalendar();

        // Set the calendar location.
        this.monthCalendar1.Location = new
 System.Drawing.Point(47, 16);

        // Change the color.
        this.monthCalendar1.BackColor = System.Drawing.SystemColors.Info;
        this.monthCalendar1.ForeColor = System.Drawing.Color.FromArgb(
                                 ((System.Byte)(192)), ((System.Byte)(0)), ((System.Byte)(192)));
        this.monthCalendar1.TitleBackColor = System.Drawing.Color.Purple;
        this.monthCalendar1.TitleForeColor = System.Drawing.Color.Yellow;
        this.monthCalendar1.TrailingForeColor = System.Drawing.Color.FromArgb(
                                 ((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(0)));

        // Add dates to the AnnuallyBoldedDates array.
        this.monthCalendar1.AnnuallyBoldedDates = 
            new System.DateTime[] { new System.DateTime(2002,
 4, 20, 0, 0, 0, 0),
                                    new System.DateTime(2002,
 4, 28, 0, 0, 0, 0),
                                    new System.DateTime(2002,
 5, 5, 0, 0, 0, 0),
                                    new System.DateTime(2002,
 7, 4, 0, 0, 0, 0),
                                    new System.DateTime(2002,
 12, 15, 0, 0, 0, 0),
                                    new System.DateTime(2002,
 12, 18, 0, 0, 0, 0)};

        // Add dates to BoldedDates array.
        this.monthCalendar1.BoldedDates = new
 System.DateTime[] {new System.DateTime(2002, 9, 26, 0, 0, 0,
 0)};

        // Add dates to MonthlyBoldedDates array.
        this.monthCalendar1.MonthlyBoldedDates = 
           new System.DateTime[] {new System.DateTime(2002,
 1, 15, 0, 0, 0, 0),
                                  new System.DateTime(2002, 1,
 30, 0, 0, 0, 0)};

        // Configure the calendar to display 3 rows by 4 columns of
 months.
        this.monthCalendar1.CalendarDimensions = new
 System.Drawing.Size(4, 3);

        // Set week to begin on Monday.
        this.monthCalendar1.FirstDayOfWeek = System.Windows.Forms.Day.Monday;

        // Set the maximum visible date on the calendar to 12/31/2010.
        this.monthCalendar1.MaxDate = new System.DateTime(2010,
 12, 31, 0, 0, 0, 0);

        // Set the minimum visible date on calendar to 12/31/2010.
        this.monthCalendar1.MinDate = new System.DateTime(1999,
 1, 1, 0, 0, 0, 0);

        // Only allow 21 days to be selected at the same time.
        this.monthCalendar1.MaxSelectionCount = 21;

        // Set the calendar to move one month at a time when navigating
 using the arrows.
        this.monthCalendar1.ScrollChange = 1;

        // Do not show the "Today" banner.
        this.monthCalendar1.ShowToday = false;

        // Do not circle today's date.
        this.monthCalendar1.ShowTodayCircle = false;
            
        // Show the week numbers to the left of each week.
        this.monthCalendar1.ShowWeekNumbers = true;

        // Add event handlers for the DateSelected and DateChanged events
        this.monthCalendar1.DateSelected += new
 System.Windows.Forms.DateRangeEventHandler(this.monthCalendar1_DateSelected);
        this.monthCalendar1.DateChanged += new
 System.Windows.Forms.DateRangeEventHandler(this.monthCalendar1_DateChanged);

        // Set up how the form should be displayed and add the controls
 to the form.
        this.ClientSize = new System.Drawing.Size(920,
 566);
        this.Controls.AddRange(new System.Windows.Forms.Control[]
 {this.textBox1, this.monthCalendar1});
        this.Text = "Month Calendar Example";
    }

    private void monthCalendar1_DateSelected(object
 sender, System.Windows.Forms.DateRangeEventArgs e)
    {
        // Show the start and end dates in the text box.
        this.textBox1.Text = "Date Selected: Start = "
 +
            e.Start.ToShortDateString() + " : End = " + e.End.ToShortDateString();
    }

    private void monthCalendar1_DateChanged(object
 sender, System.Windows.Forms.DateRangeEventArgs e)
    {
        // Show the start and end dates in the text box.
        this.textBox1.Text = "Date Changed: Start =  "
 +
            e.Start.ToShortDateString() + " : End = " + e.End.ToShortDateString();
    }
}
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>

using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
public ref class Form1: public
 System::Windows::Forms::Form
{
private:
   System::Windows::Forms::MonthCalendar^ monthCalendar1;
   System::Windows::Forms::TextBox^ textBox1;

public:
   Form1()
   {
      this->textBox1 = gcnew System::Windows::Forms::TextBox;
      this->textBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
      this->textBox1->Location = System::Drawing::Point(
 48, 488 );
      this->textBox1->Multiline = true;
      this->textBox1->ReadOnly = true;
      this->textBox1->Size = System::Drawing::Size( 824,
 32 );
      
      // Create the calendar.
      this->monthCalendar1 = gcnew System::Windows::Forms::MonthCalendar;
      
      // Set the calendar location.
      this->monthCalendar1->Location = System::Drawing::Point(
 47, 16 );
      
      // Change the color.
      this->monthCalendar1->BackColor = System::Drawing::SystemColors::Info;
      this->monthCalendar1->ForeColor = System::Drawing::Color::FromArgb(
 ((System::Byte)(192)) ),((System::Byte)(0)),((System::Byte)(192));
      this->monthCalendar1->TitleBackColor = System::Drawing::Color::Purple;
      this->monthCalendar1->TitleForeColor = System::Drawing::Color::Yellow;
      this->monthCalendar1->TrailingForeColor = System::Drawing::Color::FromArgb(
 ((System::Byte)(192)) ),((System::Byte)(192)),((System::Byte)(0));
      
      // Add dates to the AnnuallyBoldedDates array.
      array<System::DateTime>^ temp1 = {System::DateTime( 2002, 4, 20, 0, 0,
 0, 0 ),System::DateTime( 2002, 4, 28, 0, 0, 0, 0 ),System::DateTime( 2002, 5, 5,
 0, 0, 0, 0 ),System::DateTime( 2002, 7, 4, 0, 0, 0, 0 ),System::DateTime( 2002, 12, 15, 0, 0, 0, 0 ),System::DateTime( 2002, 12, 18, 0, 0, 0, 0 )};
      this->monthCalendar1->AnnuallyBoldedDates = temp1;
      
      // Add dates to BoldedDates array.
      array<System::DateTime>^ temp2 = {System::DateTime( 2002, 9, 26, 0, 0,
 0, 0 )};
      this->monthCalendar1->BoldedDates = temp2;
      
      // Add dates to MonthlyBoldedDates array.
      array<System::DateTime>^ temp5 = {System::DateTime( 2002, 1, 15, 0, 0,
 0, 0 ),System::DateTime( 2002, 1, 30, 0, 0, 0, 0 )};
      this->monthCalendar1->MonthlyBoldedDates = temp5;
      
      // Configure the calendar to display 3 rows by 4 columns of months.
      this->monthCalendar1->CalendarDimensions = System::Drawing::Size(
 4, 3 );
      
      // Set week to begin on Monday.
      this->monthCalendar1->FirstDayOfWeek = System::Windows::Forms::Day::Monday;
      
      // Set the maximum visible date on the calendar to 12/31/2010.
      this->monthCalendar1->MaxDate = System::DateTime(
 2010, 12, 31, 0, 0, 0, 0 );
      
      // Set the minimum visible date on calendar to 12/31/2010.
      this->monthCalendar1->MinDate = System::DateTime(
 1999, 1, 1, 0, 0, 0, 0 );
      
      // Only allow 21 days to be selected at the same time.
      this->monthCalendar1->MaxSelectionCount = 21;
      
      // Set the calendar to move one month at a time when navigating
 using the arrows.
      this->monthCalendar1->ScrollChange = 1;
      
      // Do not show the S"Today" banner.
      this->monthCalendar1->ShowToday = false;
      
      // Do not circle today's date.
      this->monthCalendar1->ShowTodayCircle = false;
      
      // Show the week numbers to the left of each week.
      this->monthCalendar1->ShowWeekNumbers = true;
      
      // Add event handlers for the DateSelected and DateChanged events
      this->monthCalendar1->DateSelected += gcnew System::Windows::Forms::DateRangeEventHandler(
 this, &Form1::monthCalendar1_DateSelected );
      this->monthCalendar1->DateChanged += gcnew System::Windows::Forms::DateRangeEventHandler(
 this, &Form1::monthCalendar1_DateChanged );
      
      // Set up how the form should be displayed and add the controls
 to the form.
      this->ClientSize = System::Drawing::Size( 920, 566 );
      array<System::Windows::Forms::Control^>^temp0 = {this->textBox1
,this->monthCalendar1};
      this->Controls->AddRange( temp0 );
      this->Text = "Month Calendar Example";
   }


private:
   void monthCalendar1_DateSelected( Object^ /*sender*/, System::Windows::Forms::DateRangeEventArgs^
 e )
   {
      
      // Show the start and end dates in the text box.
      this->textBox1->Text = String::Format( "Date
 Selected: Start = {0} : End = {1}", e->Start.ToShortDateString(), e->End.ToShortDateString()
 );
   }

   void monthCalendar1_DateChanged( Object^ /*sender*/, System::Windows::Forms::DateRangeEventArgs^
 e )
   {
      
      // Show the start and end dates in the text box.
      this->textBox1->Text = String::Format( "Date
 Changed: Start = {0} : End = {1}", e->Start.ToShortDateString(), e->End.ToShortDateString()
 );
   }

};


[STAThread]
int main()
{
   Application::Run( gcnew Form1 );
}

import System.*;
import System.Drawing.*;
import System.Windows.Forms.*;

public class Form1 extends System.Windows.Forms.Form
{
    private System.Windows.Forms.MonthCalendar monthCalendar1;
    private System.Windows.Forms.TextBox textBox1;

    /** @attribute STAThread()
     */
    public static void main(String[]
 args)
    {
        Application.Run(new Form1());
    } //main

    public Form1()
    {
        this.textBox1 = new System.Windows.Forms.TextBox();
        this.textBox1.set_BorderStyle(
            System.Windows.Forms.BorderStyle.FixedSingle);
        this.textBox1.set_Location(new System.Drawing.Point(48,
 488));
        this.textBox1.set_Multiline(true);
        this.textBox1.set_ReadOnly(true);
        this.textBox1.set_Size(new System.Drawing.Size(824,
 32));
        // Create the calendar.
        this.monthCalendar1 = new System.Windows.Forms.MonthCalendar();
        // Set the calendar location.
        this.monthCalendar1.set_Location(new
 System.Drawing.Point(47, 16));
        // Change the color.
        this.monthCalendar1.set_BackColor(
            System.Drawing.SystemColors.get_Info());
        this.monthCalendar1.set_ForeColor(
            System.Drawing.Color.FromArgb(192, 0, 192));
        this.monthCalendar1.set_TitleBackColor(System.Drawing.Color.get_Purple());
        this.monthCalendar1.set_TitleForeColor(System.Drawing.Color.get_Yellow());
        this.monthCalendar1.set_TrailingForeColor(
            System.Drawing.Color.FromArgb(192, 192, 0));
        // Add dates to the AnnuallyBoldedDates array.
        this.monthCalendar1.set_AnnuallyBoldedDates(new
 System.DateTime[] {
            new System.DateTime(2002, 4, 20, 0, 0, 0, 0),
            new System.DateTime(2002, 4, 28, 0, 0, 0, 0),
            new System.DateTime(2002, 5, 5, 0, 0, 0, 0),
            new System.DateTime(2002, 7, 4, 0, 0, 0, 0),
            new System.DateTime(2002, 12, 15, 0, 0, 0, 0),
            new System.DateTime(2002, 12, 18, 0, 0, 0, 0) });
        // Add dates to BoldedDates array.
        this.monthCalendar1.set_BoldedDates(new
 System.DateTime[] {
            new System.DateTime(2002, 9, 26, 0, 0, 0, 0) });
        // Add dates to MonthlyBoldedDates array.
        this.monthCalendar1.set_MonthlyBoldedDates(new
 System.DateTime[] {
            new System.DateTime(2002, 1, 15, 0, 0, 0, 0),
            new System.DateTime(2002, 1, 30, 0, 0, 0, 0) });
        // Configure the calendar to display 3 rows by 4 columns of
 months.
        this.monthCalendar1.set_CalendarDimensions(new
 System.Drawing.Size(4, 3));
        // Set week to begin on Monday.
        this.monthCalendar1.set_FirstDayOfWeek(System.Windows.Forms.Day.Monday);
        // Set the maximum visible date on the calendar to 12/31/2010.
        this.monthCalendar1.set_MaxDate(
            new System.DateTime(2010, 12, 31, 0, 0, 0, 0));
        // Set the minimum visible date on calendar to 12/31/2010.
        this.monthCalendar1.set_MinDate(
            new System.DateTime(1999, 1, 1, 0, 0, 0, 0));
        // Only allow 21 days to be selected at the same time.
        this.monthCalendar1.set_MaxSelectionCount(21);
        // Set the calendar to move one month at a time when navigating
        // using the arrows.
        this.monthCalendar1.set_ScrollChange(1);
        // Do not show the "Today" banner.
        this.monthCalendar1.set_ShowToday(false);
        // Do not circle today's date.
        this.monthCalendar1.set_ShowTodayCircle(false);
        // Show the week numbers to the left of each week.
        this.monthCalendar1.set_ShowWeekNumbers(true);
        // Add event handlers for the DateSelected and DateChanged events
        this.monthCalendar1.add_DateSelected(
            new System.Windows.Forms.DateRangeEventHandler(
            this.monthCalendar1_DateSelected));
        this.monthCalendar1.add_DateChanged(
            new System.Windows.Forms.DateRangeEventHandler(
            this.monthCalendar1_DateChanged));
        // Set up how the form should be displayed and add the controls
 to
        // the form.
        this.set_ClientSize(new System.Drawing.Size(920,
 566));
        this.get_Controls().AddRange(new System.Windows.Forms.Control[]
 {
            this.textBox1, this.monthCalendar1
 });
        this.set_Text("Month Calendar Example");
    } //Form1

    private void monthCalendar1_DateSelected(Object
 sender,
        System.Windows.Forms.DateRangeEventArgs e)
    {
        // Show the start and end dates in the text box.
        this.textBox1.set_Text("Date Selected: Start = "
            + e.get_Start().ToShortDateString() + " : End = "
            + e.get_End().ToShortDateString());
    } //monthCalendar1_DateSelected

    private void monthCalendar1_DateChanged(Object
 sender,
        System.Windows.Forms.DateRangeEventArgs e)
    {
        // Show the start and end dates in the text box.
        this.textBox1.set_Text("Date Changed: Start =  "
            + e.get_Start().ToShortDateString() + " : End = "
            + e.get_End().ToShortDateString());
    } //monthCalendar1_DateChanged
} //Form1
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MonthCalendar クラス
MonthCalendar メンバ
System.Windows.Forms 名前空間
DateSelected



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

辞書ショートカット

すべての辞書の索引

「MonthCalendar.DateChanged イベント」の関連用語

MonthCalendar.DateChanged イベントのお隣キーワード
検索ランキング

   

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



MonthCalendar.DateChanged イベントのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS