Table of Contents

Class ExDateTimePicker

Namespace
ExControls
Assembly
ExControls.dll

Date/time picker drawn completely by the library (no Win32 DateTimePicker). The drop-down part is an ExCalendar. Public API mirrors DateTimePicker so the controls are interchangeable.

[ToolboxBitmap(typeof(ToolboxIcons), "Toolbox.ExDateTimePicker.ico")]
[DefaultBindingProperty("Value")]
public class ExDateTimePicker : Control, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IExControl, IThemeable
Inheritance
ExDateTimePicker
Implements
Inherited Members
Extension Methods

Constructors

ExDateTimePicker()

Initializes a new instance of the ExDateTimePicker class in the default style with the current date and time in the long format.

public ExDateTimePicker()

Fields

MaximumDateTime

Maximum date the control accepts (same as MaximumDateTime).

public static readonly DateTime MaximumDateTime

Field Value

DateTime

MinimumDateTime

Minimum date the control accepts (same as MinimumDateTime).

public static readonly DateTime MinimumDateTime

Field Value

DateTime

Properties

ArrowColor

Color of the arrow(s) on the drop-down/spin button.

[ExCategory(CategoryType.Appearance)]
[ExDescription("Color of the arrow(s) on the drop-down/spin button.")]
public Color ArrowColor { get; set; }

Property Value

Color

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

Color

ButtonBackColor

Background color of the drop-down/spin button.

[ExCategory(CategoryType.Appearance)]
[ExDescription("Background color of the drop-down/spin button.")]
public Color ButtonBackColor { get; set; }

Property Value

Color

Calendar

Calendar shown in the drop-down. Its appearance (colors, TodayText, ShowWeekNumbers...) can be set here.

[ExCategory(CategoryType.Appearance)]
[ExDescription("Calendar shown in the drop-down.")]
public ExCalendar Calendar { get; }

Property Value

ExCalendar

Checked

Whether the value is selected (has meaning only when ShowCheckBox is true).

[ExCategory(CategoryType.Behavior)]
[Bindable(true)]
[ExDescription("Whether the value is selected (has meaning only when ShowCheckBox is true).")]
public bool Checked { get; set; }

Property Value

bool

CustomFormat

Custom format string used when Format is Custom.

[ExCategory(CategoryType.Behavior)]
[ExDescription("Custom format string used when Format is Custom.")]
public string? CustomFormat { get; set; }

Property Value

string

DefaultSize

Gets the default size of the control.

protected override Size DefaultSize { get; }

Property Value

Size

The default Size of the control.

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

bool

DisabledBackColor

Background color when the control is disabled.

[ExCategory(CategoryType.Appearance)]
[ExDescription("Background color when the control is disabled.")]
public Color DisabledBackColor { get; set; }

Property Value

Color

DisabledForeColor

Text color when the control is disabled or unchecked.

[ExCategory(CategoryType.Appearance)]
[ExDescription("Text color when the control is disabled or unchecked.")]
public Color DisabledForeColor { get; set; }

Property Value

Color

DropDownAlign

Alignment of the drop-down calendar.

[ExCategory(CategoryType.Appearance)]
[ExDescription("Alignment of the drop-down calendar.")]
public LeftRightAlignment DropDownAlign { get; set; }

Property Value

LeftRightAlignment

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.

Format

Format of the displayed date/time.

[ExCategory(CategoryType.Appearance)]
[ExDescription("Format of the displayed date/time.")]
public DateTimePickerFormat Format { get; set; }

Property Value

DateTimePickerFormat

HighlightColor

Color of the border and of the pressed button when the mouse is over the control or it has focus.

[ExCategory(CategoryType.Appearance)]
[ExDescription("Color of the border and of the pressed button when the mouse is over the control or it has focus.")]
public Color HighlightColor { get; set; }

Property Value

Color

MaxDate

Gets or sets the maximum selectable date and time; a value after it is moved to it.

[ExCategory(CategoryType.Behavior)]
[ExDescription("Maximum selectable date.")]
public DateTime MaxDate { get; set; }

Property Value

DateTime

Exceptions

ArgumentOutOfRangeException

when the value is before MinDate.

MinDate

Gets or sets the minimum selectable date and time; a value before it is moved to it.

[ExCategory(CategoryType.Behavior)]
[ExDescription("Minimum selectable date.")]
public DateTime MinDate { get; set; }

Property Value

DateTime

Exceptions

ArgumentOutOfRangeException

when the value is after MaxDate.

PreferredHeight

Height of the control computed from the font.

[Browsable(false)]
public int PreferredHeight { get; }

Property Value

int

SelectedFieldBackColor

Background color of the selected field (day, month...).

[ExCategory(CategoryType.Appearance)]
[ExDescription("Background color of the selected field (day, month...).")]
public Color SelectedFieldBackColor { get; set; }

Property Value

Color

SelectedFieldForeColor

Text color of the selected field (day, month...).

[ExCategory(CategoryType.Appearance)]
[ExDescription("Text color of the selected field (day, month...).")]
public Color SelectedFieldForeColor { get; set; }

Property Value

Color

ShowCheckBox

Shows a check box; when unchecked, no value is selected.

[ExCategory(CategoryType.Appearance)]
[ExDescription("Shows a check box; when unchecked, no value is selected.")]
public bool ShowCheckBox { get; set; }

Property Value

bool

ShowUpDown

Shows a spin control instead of the drop-down calendar.

[ExCategory(CategoryType.Appearance)]
[ExDescription("Shows a spin control instead of the drop-down calendar.")]
public bool ShowUpDown { get; set; }

Property Value

bool

Text

Formatted value. Empty when ShowCheckBox is true and the control is unchecked. Setting parses the string using the current format.

[Browsable(false)]
[Bindable(false)]
[AllowNull]
public override string Text { get; set; }

Property Value

string

Value

Selected date and time.

[ExCategory(CategoryType.Behavior)]
[ExDescription("Selected date and time.")]
[Bindable(true)]
public DateTime Value { get; set; }

Property Value

DateTime

Methods

ApplyTheme(ExTheme)

Sets the colors and appearance of the control by the theme.

public void ApplyTheme(ExTheme theme)

Parameters

theme ExTheme

CloseDropDown()

Closes the drop-down calendar.

public void CloseDropDown()

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

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

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

keyData Keys

One of the Keys values.

Returns

bool

true if the specified key is a regular input key; otherwise, false.

OnCheckedChanged(EventArgs)

Raises the CheckedChanged event.

protected virtual void OnCheckedChanged(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

OnCloseUp(EventArgs)

Raises the CloseUp event.

protected virtual void OnCloseUp(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

OnDefaultStyleChanged()

Raises the DefaultStyleChanged event.

protected virtual void OnDefaultStyleChanged()

OnDropDown(EventArgs)

Raises the DropDown event.

protected virtual void OnDropDown(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

OnEnabledChanged(EventArgs)

Raises the EnabledChanged event.

protected override void OnEnabledChanged(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

OnFontChanged(EventArgs)

Raises the FontChanged event.

protected override void OnFontChanged(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

OnFormatChanged(EventArgs)

Raises the FormatChanged event.

protected virtual void OnFormatChanged(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

OnGotFocus(EventArgs)

Raises the GotFocus event.

protected override void OnGotFocus(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

OnKeyDown(KeyEventArgs)

Raises the KeyDown event.

protected override void OnKeyDown(KeyEventArgs e)

Parameters

e KeyEventArgs

A KeyEventArgs that contains the event data.

OnKeyPress(KeyPressEventArgs)

Raises the KeyPress event.

protected override void OnKeyPress(KeyPressEventArgs e)

Parameters

e KeyPressEventArgs

A KeyPressEventArgs that contains the event data.

OnLostFocus(EventArgs)

Raises the LostFocus event.

protected override void OnLostFocus(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

OnMouseDown(MouseEventArgs)

Raises the MouseDown event.

protected override void OnMouseDown(MouseEventArgs e)

Parameters

e MouseEventArgs

A MouseEventArgs that contains the event data.

OnMouseEnter(EventArgs)

Raises the MouseEnter event.

protected override void OnMouseEnter(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

OnMouseLeave(EventArgs)

Raises the MouseLeave event.

protected override void OnMouseLeave(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

OnMouseMove(MouseEventArgs)

Raises the MouseMove event.

protected override void OnMouseMove(MouseEventArgs e)

Parameters

e MouseEventArgs

A MouseEventArgs that contains the event data.

OnMouseUp(MouseEventArgs)

Raises the MouseUp event.

protected override void OnMouseUp(MouseEventArgs e)

Parameters

e MouseEventArgs

A MouseEventArgs that contains the event data.

OnMouseWheel(MouseEventArgs)

Raises the MouseWheel event.

protected override void OnMouseWheel(MouseEventArgs e)

Parameters

e MouseEventArgs

A MouseEventArgs that contains the event data.

OnPaint(PaintEventArgs)

Raises the Paint event.

protected override void OnPaint(PaintEventArgs e)

Parameters

e PaintEventArgs

A PaintEventArgs that contains the event data.

OnValueChanged(EventArgs)

Raises the ValueChanged event.

protected virtual void OnValueChanged(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

ProcessCmdKey(ref Message, Keys)

Processes a command key.

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)

Parameters

msg Message

A Message, passed by reference, that represents the window message to process.

keyData Keys

One of the Keys values that represents the key to process.

Returns

bool

true if the character was processed by the control; otherwise, false.

RescaleConstantsForDpi(int, int)

Provides constants for rescaling the control when a DPI change occurs.

protected override void RescaleConstantsForDpi(int deviceDpiOld, int deviceDpiNew)

Parameters

deviceDpiOld int

The DPI value prior to the change.

deviceDpiNew int

The DPI value after the change.

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

x int

The new Left property value of the control.

y int

The new Top property value of the control.

width int

The new Width property value of the control.

height int

The new Height property value of the control.

specified BoundsSpecified

A bitwise combination of the BoundsSpecified values.

ShowDropDown()

Shows the drop-down calendar.

public void ShowDropDown()

Events

CheckedChanged

Occurs when Checked changes.

[ExCategory(CategoryType.Action)]
[ExDescription("Occurs when the Checked property changes.")]
public event EventHandler? CheckedChanged

Event Type

EventHandler

CloseUp

Occurs when the drop-down calendar is closed.

[ExCategory(CategoryType.Action)]
[ExDescription("Occurs when the drop-down calendar is closed.")]
public event EventHandler? CloseUp

Event Type

EventHandler

DefaultStyleChanged

Occurs when the DefaultStyle property changes.

[ExCategory("Changed Property")]
[ExDescription("Occurs when the DefaultStyle property changes.")]
public event EventHandler? DefaultStyleChanged

Event Type

EventHandler

DropDown

Occurs when the drop-down calendar is shown.

[ExCategory(CategoryType.Action)]
[ExDescription("Occurs when the drop-down calendar is shown.")]
public event EventHandler? DropDown

Event Type

EventHandler

FormatChanged

Occurs when Format changes.

[ExCategory(CategoryType.Action)]
[ExDescription("Occurs when the Format property changes.")]
public event EventHandler? FormatChanged

Event Type

EventHandler

ValueChanged

Occurs when Value changes.

[ExCategory(CategoryType.Action)]
[ExDescription("Occurs when the Value property changes.")]
public event EventHandler? ValueChanged

Event Type

EventHandler