You can create a GcDateTime cell that displays date and time values. This can be useful if you want to restrict the type of data the user can type in the cell. The GcDateTimeCellType is part of the GrapeCity.Win.PluginInputMan assembly.

The GcDateTime cell allows the user to pick a date from a calendar drop-down or type in the cell.

The GcDateTime cell supports different calendar styles. You can set colors and styles with the DropDownCalendar class. You can specify which fields to display with the DisplayFields property.

You can specify the focus position when the cell gets focus with the FocusPosition property and you can specify whether focus leaves the cell after typing the last character in the date value with the ExitOnLastChar property.

You can use the ShortcutKeys property to map keys to actions for the GcDateTime cell. In edit mode, these shortcut keys have precedence over the Spread input maps. The cell uses the Spread input maps when not in edit mode.

You can specify the type of drop-down to display with the DropDownType property. The drop-down picker type is easier to use in a touch environment.

The GcDateTimeCellType class has the following properties:
AcceptsArrowKeysGets or sets how arrow keys are processed by the edit control. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase)
AcceptsCrLfGets or sets a value that indicates how to process the CrLf characters when copying, cutting, or pasting the string.
AlternateTextGets the alternate text of the GcDateTimeCellType object.
BackgroundImageGets or sets the background image for the cell. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase)
ClipContentGets or sets how data is copied to the Clipboard. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.FieldsEditorControlCellType)
DefaultActiveFieldGets or sets the default active field of the cell.
DisplayFieldsGets the display fields of the GcDateTimeCellType object.
DropDownGets the drop-down settings for the drop-down function.
DropDownCalendarGets the settings for the drop-down calendar.
DropDownPickerGets the settings for the drop-down picker.
EditModeGets or sets the edit mode of the control. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase)
ExcelExportFormatOverridden. Gets or sets the excel export format.
ExitOnLastCharGets or sets whether the next control in the tab order receives the focus as soon as the control is filled with the last character. (Inherited from  GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase)
FieldsA GrapeCity.Win.Spread.InputMan.CellType.DateFieldCollection that represents the items in the GcDateTime object.
FieldsEditModeGets or sets the fields edit mode.
FocusPositionGets or sets the initial cursor position when the editor gets focus.
MaxDateGets or sets the maximum allowable value when changing the field or value of the control using the spin setting.
MaxMinBehaviorGets or sets the behavior when the new input value is outside of GcDateTime.MinDate and GcDateTime.MaxDate.
MinDateGets or sets the minimum allowable value when changing the field or value of the control using the spin setting.
PaintByControlGets or sets a value that indicates how to paint the cell. If true, the cell uses the inner control's painting to paint the cell, in this case, the cell paints exactly the same as the editing control. All settings of the cell such as fields with different styles are shown when painting the cell. The cell's paint performance is slow if painting by the control, rather than painting the string directly. Also, the text in the cell cannot be selected when exporting to pdf. If false, performance is good but some settings do not take effect.
PromptCharGets or sets the character used as a prompt for input. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.FieldsEditorControlCellType)
ReadOnlyGets or sets a value that indicates whether this control is read-only. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase)
RecommendedValueGets or sets the recommended value.
ShortcutKeysGets the InputMan EditingControl's shortcuts. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase)
ShowLiteralsGets or sets whether to display the literals during user entry. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.FieldsEditorControlCellType)
ShowRecommendedValueGets or sets a value that indicates whether to show the recommended value.
ShowTouchToolBarGets or sets how to show the InputManCellTypeBase.TouchToolBar. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase)
SideButtonsGets a collection of side buttons.
SpinGets the spin function settings.
StaticGets or sets whether the cell is static, which prohibits user interaction. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase
SubEditorGets or sets the subeditor. (Inherited from FarPoint.Win.Spread.CellType.BaseCellType)
TabActionGets or sets whether the tab key moves the focus between controls or between fields within the control. (Inherited fromGrapeCity.Win.Spread.InputMan.CellType.FieldsEditorControlCellType)
TouchContextMenuScaleGets or sets the factor applied to the context menu item's height while the context menu is open when using touch. (Inherited fromGrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase)
TouchToolBarGets the displayed InputManCellTypeBase.TouchToolBar when using a  touch operation. (Inherited from GrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase)
UseSpreadDropDownButtonRenderGets or sets a value that indicates whether to paint the drop-down button with the spread drop-down button renderer. (Inherited fromGrapeCity.Win.Spread.InputMan.CellType.InputManCellTypeBase)
ValidateModeGets or sets the validation mode during control input.

This example uses the ShortcutKeys property. Use the Tab key to put a date in the cell while the cell is in edit mode. The following image displays the list of actions that you can use.


GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType inputcell = new GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType();
inputcell.ShortcutKeys.Add(System.Windows.Forms.Keys.Tab, "SetNow");
fpSpread1.Sheets[0].Cells[0, 0].CellType = inputcell;

Dim inputcell As New GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType()
inputcell.ShortcutKeys.Add(System.Windows.Forms.Keys.Tab, "SetNow")
FpSpread1.Sheets(0).Cells(0, 0).CellType = inputcell

This example sets colors for the calendar and displays a border around today’s date.

Drop-down Calendar

GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType inputcell = new GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType();
inputcell.DropDownCalendar.BackColor = Color.Aquamarine;
inputcell.DropDownCalendar.TodayMarkColor = Color.Firebrick;
inputcell.DropDownCalendar.BorderStyle = BorderStyle.FixedSingle;
inputcell.DropDownCalendar.ShowTodayMark = true;
fpSpread1.Sheets[0].Cells[0, 0].CellType = inputcell;
fpSpread1.Sheets[0].Columns[0].Width = 100;

Dim inputcell As New GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType()
inputcell.DropDownCalendar.BackColor = Color.Aquamarine
inputcell.DropDownCalendar.TodayMarkColor = Color.Firebrick
inputcell.DropDownCalendar.BorderStyle = BorderStyle.FixedSingle
inputcell.DropDownCalendar.ShowTodayMark = True
FpSpread1.Sheets(0).Cells(0, 0).CellType = inputcell
FpSpread1.Sheets(0).Columns(0).Width = 100

This example creates a custom format for the GcDateTime cell.

Custom Format

GrapeCity.Win.Spread.InputMan.CellType.Fields.DateDayFieldInfo fvalue = new GrapeCity.Win.Spread.InputMan.CellType.Fields.DateDayFieldInfo();
fvalue.BackColor = Color.Lavender;
GrapeCity.Win.Spread.InputMan.CellType.Fields.DateMonthFieldInfo mvalue = new GrapeCity.Win.Spread.InputMan.CellType.Fields.DateMonthFieldInfo();
mvalue.BackColor = Color.Azure;
GrapeCity.Win.Spread.InputMan.CellType.Fields.DateYearFieldInfo yvalue = new GrapeCity.Win.Spread.InputMan.CellType.Fields.DateYearFieldInfo();
yvalue.BackColor = Color.Crimson;
GrapeCity.Win.Spread.InputMan.CellType.Fields.DateLiteralFieldInfo eday = new GrapeCity.Win.Spread.InputMan.CellType.Fields.DateLiteralFieldInfo();
eday.Text = "/";

GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType inputcell = new GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType();
GrapeCity.Win.Spread.InputMan.CellType.Fields.DateDayDisplayFieldInfo day = new GrapeCity.Win.Spread.InputMan.CellType.Fields.DateDayDisplayFieldInfo();
day.ShowLeadingZero = true;
GrapeCity.Win.Spread.InputMan.CellType.Fields.DateMonthDisplayFieldInfo month = new GrapeCity.Win.Spread.InputMan.CellType.Fields.DateMonthDisplayFieldInfo();
month.ShowLeadingZero = true;
GrapeCity.Win.Spread.InputMan.CellType.Fields.DateYearDisplayFieldInfo year = new GrapeCity.Win.Spread.InputMan.CellType.Fields.DateYearDisplayFieldInfo();
year.ShowLeadingZero = true;
GrapeCity.Win.Spread.InputMan.CellType.Fields.DateLiteralDisplayFieldInfo lday = new GrapeCity.Win.Spread.InputMan.CellType.Fields.DateLiteralDisplayFieldInfo();
lday.Text = "/";

fpSpread1.Sheets[0].Cells[1, 1].CellType = inputcell;

Dim fvalue As New GrapeCity.Win.Spread.InputMan.CellType.Fields.DateDayFieldInfo()
fvalue.BackColor = Color.Lavender
Dim mvalue As New GrapeCity.Win.Spread.InputMan.CellType.Fields.DateMonthFieldInfo()
mvalue.BackColor = Color.Azure
Dim yvalue As New GrapeCity.Win.Spread.InputMan.CellType.Fields.DateYearFieldInfo()
yvalue.BackColor = Color.Crimson
Dim eday As New GrapeCity.Win.Spread.InputMan.CellType.Fields.DateLiteralFieldInfo()
eday.Text = "/"

Dim inputcell As New GrapeCity.Win.Spread.InputMan.CellType.GcDateTimeCellType()
Dim day As New GrapeCity.Win.Spread.InputMan.CellType.Fields.DateDayDisplayFieldInfo()
day.ShowLeadingZero = True
Dim month As New GrapeCity.Win.Spread.InputMan.CellType.Fields.DateMonthDisplayFieldInfo()
month.ShowLeadingZero = True
Dim year As New GrapeCity.Win.Spread.InputMan.CellType.Fields.DateYearDisplayFieldInfo()
year.ShowLeadingZero = True
Dim lday As New GrapeCity.Win.Spread.InputMan.CellType.Fields.DateLiteralDisplayFieldInfo()
lday.Text = "/"

FpSpread1.Sheets(0).Cells(1, 1).CellType = inputcell