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
MinimumDateTime
Minimum date the control accepts (same as MinimumDateTime).
public static readonly DateTime MinimumDateTime
Field Value
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
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
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
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
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
CustomFormat
[ExCategory(CategoryType.Behavior)]
[ExDescription("Custom format string used when Format is Custom.")]
public string? CustomFormat { 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
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
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
DropDownAlign
Alignment of the drop-down calendar.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Alignment of the drop-down calendar.")]
public LeftRightAlignment DropDownAlign { 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.
Format
Format of the displayed date/time.
[ExCategory(CategoryType.Appearance)]
[ExDescription("Format of the displayed date/time.")]
public DateTimePickerFormat Format { get; set; }
Property Value
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
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
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
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
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
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
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
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
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
Value
Selected date and time.
[ExCategory(CategoryType.Behavior)]
[ExDescription("Selected date and time.")]
[Bindable(true)]
public DateTime Value { 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
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
disposingbooltrue 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
Returns
OnCheckedChanged(EventArgs)
Raises the CheckedChanged event.
protected virtual void OnCheckedChanged(EventArgs e)
Parameters
OnCloseUp(EventArgs)
Raises the CloseUp event.
protected virtual void OnCloseUp(EventArgs e)
Parameters
OnDefaultStyleChanged()
Raises the DefaultStyleChanged event.
protected virtual void OnDefaultStyleChanged()
OnDropDown(EventArgs)
Raises the DropDown event.
protected virtual void OnDropDown(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
OnFormatChanged(EventArgs)
Raises the FormatChanged event.
protected virtual void OnFormatChanged(EventArgs e)
Parameters
OnGotFocus(EventArgs)
Raises the GotFocus event.
protected override void OnGotFocus(EventArgs e)
Parameters
OnKeyDown(KeyEventArgs)
Raises the KeyDown event.
protected override void OnKeyDown(KeyEventArgs e)
Parameters
eKeyEventArgsA KeyEventArgs that contains the event data.
OnKeyPress(KeyPressEventArgs)
Raises the KeyPress event.
protected override void OnKeyPress(KeyPressEventArgs e)
Parameters
eKeyPressEventArgsA KeyPressEventArgs that contains the event data.
OnLostFocus(EventArgs)
Raises the LostFocus event.
protected override void OnLostFocus(EventArgs e)
Parameters
OnMouseDown(MouseEventArgs)
Raises the MouseDown event.
protected override void OnMouseDown(MouseEventArgs e)
Parameters
eMouseEventArgsA MouseEventArgs that contains the event data.
OnMouseEnter(EventArgs)
Raises the MouseEnter event.
protected override void OnMouseEnter(EventArgs e)
Parameters
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.
OnMouseUp(MouseEventArgs)
Raises the MouseUp event.
protected override void OnMouseUp(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.
OnValueChanged(EventArgs)
Raises the ValueChanged event.
protected virtual void OnValueChanged(EventArgs e)
Parameters
ProcessCmdKey(ref Message, Keys)
Processes a command key.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
Parameters
msgMessageA Message, passed by reference, that represents the window message to process.
keyDataKeysOne of the Keys values that represents the key to process.
Returns
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.
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.
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
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
DefaultStyleChanged
Occurs when the DefaultStyle property changes.
[ExCategory("Changed Property")]
[ExDescription("Occurs when the DefaultStyle property changes.")]
public event EventHandler? DefaultStyleChanged
Event Type
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
FormatChanged
Occurs when Format changes.
[ExCategory(CategoryType.Action)]
[ExDescription("Occurs when the Format property changes.")]
public event EventHandler? FormatChanged
Event Type
ValueChanged
Occurs when Value changes.
[ExCategory(CategoryType.Action)]
[ExDescription("Occurs when the Value property changes.")]
public event EventHandler? ValueChanged