Class ExCalendar
- Namespace
- ExControls
- Assembly
- ExControls.dll
Month calendar control drawn completely by the library (no Win32 MonthCalendar). Used standalone or as the drop-down part of ExDateTimePicker.
[ToolboxBitmap(typeof(ToolboxIcons), "Toolbox.ExCalendar.ico")]
public class ExCalendar : Control, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IExControl, IThemeable
- Inheritance
-
ExCalendar
- Implements
- Inherited Members
- Extension Methods
Constructors
ExCalendar()
Initializes a new instance of the ExCalendar class in the default style, showing the current month with today's date selected.
public ExCalendar()
Properties
ArrowColor
Color of the previous/next month arrows.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Color of the previous/next month arrows.")]
public Color ArrowColor { get; set; }
Property Value
AutoSize
This property is not relevant for this class.
[Browsable(true)]
public override bool AutoSize { get; set; }
Property Value
BackColor
Gets or sets the background color for the control.
public override Color BackColor { get; set; }
Property Value
- Color
A Color that represents the background color of the control. The default is the value of the DefaultBackColor property.
BorderColor
Color of the border.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Color of the border.")]
public Color BorderColor { get; set; }
Property Value
DayOfWeekForeColor
Color of the day-of-week names.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Color of the day-of-week names.")]
public Color DayOfWeekForeColor { get; set; }
Property Value
DefaultSize
Gets the default size of the control.
protected override Size DefaultSize { get; }
Property Value
DefaultStyle
Gets or sets whether the control uses the default Windows style; false = the custom style drawn by the control with its own colors.
[Browsable(true)]
[ExCategory(CategoryType.Appearance)]
[ExDescription("Default style of the Control.")]
public bool DefaultStyle { get; set; }
Property Value
DisabledForeColor
Color of the days outside of the MinDate-MaxDate range and of all text when the control is disabled.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Color of the days outside of the MinDate-MaxDate range and of all text when the control is disabled.")]
public Color DisabledForeColor { get; set; }
Property Value
DisplayMonth
First day of the displayed month.
[Browsable(false)]
public DateTime DisplayMonth { get; set; }
Property Value
DrawBorder
Draws a one pixel border around the control.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Draws a one pixel border around the control.")]
public bool DrawBorder { get; set; }
Property Value
FirstDayOfWeek
First day of the week. Default uses the current culture.
[ExCategory(CategoryType.Behavior)]
[ExDescription("First day of the week. Default uses the current culture.")]
public Day FirstDayOfWeek { get; set; }
Property Value
ForeColor
Gets or sets the foreground color of the control.
public override Color ForeColor { get; set; }
Property Value
- Color
The foreground Color of the control. The default is the value of the DefaultForeColor property.
HeaderForeColor
Color of the month/year header text.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Color of the month/year header text.")]
public Color HeaderForeColor { get; set; }
Property Value
HighlightColor
Background color of the selected day.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Background color of the selected day.")]
public Color HighlightColor { get; set; }
Property Value
HighlightForeColor
Text color of the selected day.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Text color of the selected day.")]
public Color HighlightForeColor { get; set; }
Property Value
HoverBackColor
Background color of the day or arrow under the mouse.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Background color of the day or arrow under the mouse.")]
public Color HoverBackColor { get; set; }
Property Value
MaxDate
Gets or sets the maximum selectable date; a selected date after it is moved to it.
[ExCategory(CategoryType.Behavior)]
[ExDescription("Maximum selectable date.")]
public DateTime MaxDate { get; set; }
Property Value
Exceptions
- ArgumentOutOfRangeException
when the date is before MinDate.
MinDate
Gets or sets the minimum selectable date; a selected date before it is moved to it.
[ExCategory(CategoryType.Behavior)]
[ExDescription("Minimum selectable date.")]
public DateTime MinDate { get; set; }
Property Value
Exceptions
- ArgumentOutOfRangeException
when the date is after MaxDate.
SelectionDate
Selected date (time part is ignored).
[ExCategory(CategoryType.Behavior)]
[ExDescription("Selected date.")]
[Bindable(true)]
public DateTime SelectionDate { get; set; }
Property Value
ShowToday
Shows the "Today" line at the bottom of the calendar.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Shows the Today line at the bottom of the calendar.")]
public bool ShowToday { get; set; }
Property Value
ShowWeekNumbers
Shows week numbers in the first column.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Shows week numbers in the first column.")]
public bool ShowWeekNumbers { get; set; }
Property Value
TodayBorderColor
Color of the frame around today's date.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Color of the frame around today's date.")]
public Color TodayBorderColor { get; set; }
Property Value
TodayDate
Date treated as "today". When not set, Today is used.
[ExCategory(CategoryType.Behavior)]
[ExDescription("Date treated as today. When not set, the system date is used.")]
public DateTime TodayDate { get; set; }
Property Value
TodayText
Label shown before today's date in the "Today" line.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Label shown before today's date in the Today line.")]
public string TodayText { get; set; }
Property Value
TrailingForeColor
Color of the days that belong to the previous or next month.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Color of the days that belong to the previous or next month.")]
public Color TrailingForeColor { get; set; }
Property Value
View
Current view: days of a month, months of a year, years of a decade or decades of a century. Clicking the header switches to the next coarser view, clicking an item goes back down.
[Browsable(false)]
public ExCalendarView View { get; set; }
Property Value
WeekNumberForeColor
Color of the week numbers.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Color of the week numbers.")]
public Color WeekNumberForeColor { get; set; }
Property Value
Methods
ApplyTheme(ExTheme)
Sets the colors and appearance of the control by the theme.
public void ApplyTheme(ExTheme theme)
Parameters
themeExTheme
Dispose(bool)
Releases the unmanaged resources used by the Control and its child controls and optionally releases the managed resources.
protected override void Dispose(bool disposing)
Parameters
disposingbooltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
EnsureVisible(DateTime)
Scrolls the calendar so that the month of the date is visible.
public void EnsureVisible(DateTime date)
Parameters
dateDateTimedate to show
GetPreferredSize(Size)
Retrieves the size of a rectangular area into which a control can be fitted.
public override Size GetPreferredSize(Size proposedSize)
Parameters
proposedSizeSizeThe custom-sized area for a control.
Returns
HitTestDate(Point)
Returns the date at the specified client point, or null when there is no day.
public DateTime? HitTestDate(Point pt)
Parameters
ptPointpoint in client coordinates
Returns
IsInputKey(Keys)
Determines whether the specified key is a regular input key or a special key that requires preprocessing.
protected override bool IsInputKey(Keys keyData)
Parameters
Returns
OnDateChanged(EventArgs)
Raises the DateChanged event.
protected virtual void OnDateChanged(EventArgs e)
Parameters
OnDateSelected(EventArgs)
Raises the DateSelected event.
protected virtual void OnDateSelected(EventArgs e)
Parameters
OnDefaultStyleChanged()
Raises the DefaultStyleChanged event.
protected virtual void OnDefaultStyleChanged()
OnDisplayMonthChanged(EventArgs)
Raises the DisplayMonthChanged event.
protected virtual void OnDisplayMonthChanged(EventArgs e)
Parameters
OnEnabledChanged(EventArgs)
Raises the EnabledChanged event.
protected override void OnEnabledChanged(EventArgs e)
Parameters
OnFontChanged(EventArgs)
Raises the FontChanged event.
protected override void OnFontChanged(EventArgs e)
Parameters
OnHandleCreated(EventArgs)
Raises the HandleCreated event.
protected override void OnHandleCreated(EventArgs e)
Parameters
OnKeyDown(KeyEventArgs)
Raises the KeyDown event.
protected override void OnKeyDown(KeyEventArgs e)
Parameters
eKeyEventArgsA KeyEventArgs that contains the event data.
OnMouseDown(MouseEventArgs)
Raises the MouseDown event.
protected override void OnMouseDown(MouseEventArgs e)
Parameters
eMouseEventArgsA MouseEventArgs that contains the event data.
OnMouseLeave(EventArgs)
Raises the MouseLeave event.
protected override void OnMouseLeave(EventArgs e)
Parameters
OnMouseMove(MouseEventArgs)
Raises the MouseMove event.
protected override void OnMouseMove(MouseEventArgs e)
Parameters
eMouseEventArgsA MouseEventArgs that contains the event data.
OnMouseWheel(MouseEventArgs)
Raises the MouseWheel event.
protected override void OnMouseWheel(MouseEventArgs e)
Parameters
eMouseEventArgsA MouseEventArgs that contains the event data.
OnPaint(PaintEventArgs)
Raises the Paint event.
protected override void OnPaint(PaintEventArgs e)
Parameters
ePaintEventArgsA PaintEventArgs that contains the event data.
OnResize(EventArgs)
Raises the Resize event.
protected override void OnResize(EventArgs e)
Parameters
RescaleConstantsForDpi(int, int)
Provides constants for rescaling the control when a DPI change occurs.
protected override void RescaleConstantsForDpi(int deviceDpiOld, int deviceDpiNew)
Parameters
deviceDpiOldintThe DPI value prior to the change.
deviceDpiNewintThe DPI value after the change.
SelectToday()
Selects today's date and raises DateSelected.
public void SelectToday()
SetBoundsCore(int, int, int, int, BoundsSpecified)
Performs the work of setting the specified bounds of this control.
protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
Parameters
xintThe new Left property value of the control.
yintThe new Top property value of the control.
widthintThe new Width property value of the control.
heightintThe new Height property value of the control.
specifiedBoundsSpecifiedA bitwise combination of the BoundsSpecified values.
Events
DateChanged
Occurs when SelectionDate changes.
[ExCategory(CategoryType.Action)]
[ExDescription("Occurs when the SelectionDate property changes.")]
public event EventHandler? DateChanged
Event Type
DateSelected
Occurs when the user picks a date (mouse click, Enter or the Today line).
[ExCategory(CategoryType.Action)]
[ExDescription("Occurs when the user picks a date with the mouse or keyboard.")]
public event EventHandler? DateSelected
Event Type
DefaultStyleChanged
Occurs when the DefaultStyle property changes.
[ExCategory("Changed Property")]
[ExDescription("Occurs when the DefaultStyle property changes.")]
public event EventHandler? DefaultStyleChanged
Event Type
DisplayMonthChanged
Occurs when DisplayMonth changes.
[ExCategory(CategoryType.Action)]
[ExDescription("Occurs when the displayed month changes.")]
public event EventHandler? DisplayMonthChanged