Spread Windows Forms 7.0 Product Documentation
DisplayFields Property
See Also  Example Support Options
GrapeCity.Win.PluginInputMan Assembly > GrapeCity.Win.Spread.InputMan.CellType Namespace > GcDateTimeCellType Class : DisplayFields Property


Glossary Item Box

Gets the display fields of the GcDateTimeCellType object.

Syntax

Visual Basic (Declaration) 
Public Property DisplayFields As DateTimeDisplayFieldCollectionInfo
Visual Basic (Usage)Copy Code
Dim instance As GcDateTimeCellType
Dim value As DateTimeDisplayFieldCollectionInfo
 
instance.DisplayFields = value
 
value = instance.DisplayFields
C# 
public DateTimeDisplayFieldCollectionInfo DisplayFields {get; set;}

Property Value

A GrapeCity.Win.Spread.InputMan.CellType.DateDisplayFieldCollection object that indicates the collection of the display fields.

Remarks

This property determines how to display the GcDateTime.Value of this control without input focus.

Example

This example creates a custom format for the GcDateTime cell.

If the DisplayFields count is greater than 0, the cell uses "DisplayFields" to paint the cell when not in edit mode, and uses "Fields" to paint the cell when in edit mode. If the DisplayFields count is 0, both display and edit modes use "Fields". Before adding a new field, remove the old field first.

C#Copy Code
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 = "/";
inputcell.DisplayFields.Add(month);
inputcell.DisplayFields.Add(lday);
inputcell.DisplayFields.Add(day);
inputcell.DisplayFields.Add(lday);
inputcell.DisplayFields.Add(year);

inputcell.Fields.Clear();
inputcell.Fields.Add(mvalue);
inputcell.Fields.Add(eday);
inputcell.Fields.Add(fvalue);
inputcell.Fields.Add(eday);
inputcell.Fields.Add(yvalue);
fpSpread1.Sheets[0].Cells[1, 1].CellType = inputcell;
VB.NETCopy Code
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 = "/"
inputcell.DisplayFields.Add(month)
inputcell.DisplayFields.Add(lday)
inputcell.DisplayFields.Add(day)
inputcell.DisplayFields.Add(lday)
inputcell.DisplayFields.Add(year)

inputcell.Fields.Clear()
inputcell.Fields.Add(mvalue)
inputcell.Fields.Add(eday)
inputcell.Fields.Add(fvalue)
inputcell.Fields.Add(eday)
inputcell.Fields.Add(yvalue)
FpSpread1.Sheets(0).Cells(1, 1).CellType = inputcell

Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.