System.Windows.Forms.MonthCalendar Class

Represents a Windows control that enables the user to select a date using a visual monthly calendar display.

See Also: MonthCalendar Members

Syntax

[System.ComponentModel.Designer("System.Windows.Forms.Design.MonthCalendarDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
[System.ComponentModel.DefaultEvent("DateChanged")]
[System.ComponentModel.DefaultProperty("SelectionRange")]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.ComponentModel.DefaultBindingProperty("SelectionRange")]
public class MonthCalendar : Control

Remarks

The System.Windows.Forms.MonthCalendar control allows the user to select a date using a visual display. You can limit the date and times that can be selected by setting the MonthCalendar.MinDate and MonthCalendar.MaxDate properties.

You can change the look of the calendar portion of the control by setting the Control.ForeColor, Control.Font, MonthCalendar.TitleBackColor, MonthCalendar.TitleForeColor, MonthCalendar.TrailingForeColor, and Control.BackColor properties.

Note:

The System.Windows.Forms.DateTimePicker control only supports Gregorian calendars.

Note:

The System.Windows.Forms.DateTimePicker control only supports Gregorian calendars.

The System.Windows.Forms.MonthCalendar control is drawn by the operating system, so the MonthCalendar.Paint event is never raised. If you need to provide a customized look to the System.Windows.Forms.MonthCalendar control, you should override the Control.OnPrint(PaintEventArgs) method, call the base implementation of Control.OnPrint(PaintEventArgs), and then perform custom painting.

If you need custom date formatting and a selection limited to just one date, you might consider using a System.Windows.Forms.DateTimePicker control instead of a System.Windows.Forms.MonthCalendar. Using the System.Windows.Forms.DateTimePicker eliminates much of the need for validating date/time values.

For more information on month calendar controls, see tp://go.microsoft.com/fwlink/?LinkId=178863.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0