Spread Windows Forms 10.0 Product Documentation > Developer's Guide > Customizing Interaction with Cell Types > Working with Editable Cell Types > Setting a GcTimeSpan Cell |
You can use the GcTimeSpan cell to display time values in a cell.
You can specify literals and a pattern for the characters the user is allowed to enter.
The following table lists the characters you can use to create a pattern:
Keyword | Description |
---|---|
d | Represents the day field. |
h | Represents the hour field. |
m | Represents the minute field. |
s | Represents the second field. |
You can use the following classes with the GcTimeSpan cell to create display fields (literals) and input fields:
For a complete list of properties and methods for the GcTimeSpan cell, refer to the GcTimeSpanCellType class.
This example creates a GcTimeSpan cell.
C# |
Copy Code
|
---|---|
GrapeCity.Win.Spread.InputMan.CellType.GcTimeSpanCellType GC = new GrapeCity.Win.Spread.InputMan.CellType.GcTimeSpanCellType(); GC.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.AllArrows; GC.EditMode = GrapeCity.Win.Spread.InputMan.CellType.EditMode.Overwrite; GC.ExitOnLastChar = true; GC.Fields.Clear(); GC.Fields.AddRange("d.hh:mm:ss,7,.,,,-,"); GC.DisplayFields.Clear(); GC.DisplayFields.AddRange("d.hh:mm:ss,7,.,,,-,"); GC.DefaultActiveField = GC.Fields[1]; GC.FocusPosition = GrapeCity.Win.Spread.InputMan.CellType.FieldsEditorFocusCursorPosition.SelectAll; GC.MaxMinBehavior = GrapeCity.Win.Spread.InputMan.CellType.MaxMinBehavior.Clear; GC.NegativeColor = Color.Chocolate; GC.PaintByControl = true; GC.ShowRecommendedValue = true; GC.SideButtons.Add(new GrapeCity.Win.Spread.InputMan.CellType.SpinButtonInfo()); GC.Spin.AllowSpin = true; GC.Spin.Increment = 1; GC.Spin.SpinOnKeys = true; GC.Spin.SpinOnWheel = true; GC.Spin.Wrap = true; GC.UseNegativeColor = true; GC.ValidateMode = GrapeCity.Win.Spread.InputMan.CellType.ValidateMode.ValidateNone; GC.ValueSign = GrapeCity.Win.Spread.InputMan.CellType.ValueSignControl.Positive; GC.UseSpreadDropDownButtonRender = true; fpSpread1.ActiveSheet.Cells[0, 0].CellType = GC; |
VB |
Copy Code
|
---|---|
Dim GC As New GrapeCity.Win.Spread.InputMan.CellType.GcTimeSpanCellType() GC.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.AllArrows GC.EditMode = GrapeCity.Win.Spread.InputMan.CellType.EditMode.Overwrite GC.ExitOnLastChar = True GC.Fields.Clear() GC.Fields.AddRange("d.hh:mm:ss,7,.,,,-,") GC.DisplayFields.Clear() GC.DisplayFields.AddRange("d.hh:mm:ss,7,.,,,-,") GC.DefaultActiveField = GC.Fields(1) GC.FocusPosition = GrapeCity.Win.Spread.InputMan.CellType.FieldsEditorFocusCursorPosition.SelectAll GC.MaxMinBehavior = GrapeCity.Win.Spread.InputMan.CellType.MaxMinBehavior.Clear GC.NegativeColor = Color.Chocolate GC.PaintByControl = True GC.ShowRecommendedValue = True GC.SideButtons.Add(New GrapeCity.Win.Spread.InputMan.CellType.SpinButtonInfo()) GC.Spin.AllowSpin = True GC.Spin.Increment = 1 GC.Spin.SpinOnKeys = True GC.Spin.SpinOnWheel = True GC.Spin.Wrap = True GC.UseNegativeColor = True GC.ValidateMode = GrapeCity.Win.Spread.InputMan.CellType.ValidateMode.ValidateNone GC.ValueSign = GrapeCity.Win.Spread.InputMan.CellType.ValueSignControl.Positive GC.UseSpreadDropDownButtonRender = True FpSpread1.ActiveSheet.Cells(0, 0).CellType = GC |
Or right-click on the cell or cells and select Cell Type. From the list, select GcTimeSpan. In the CellType editor, set the properties you need. Click Apply.