// Please use the following namespace
// using System.Windows.Forms;
// using GrapeCity.Win.Editors;
// using System.Drawing;
public void SetAlternateTextSettings()
{
// Creates an instance of a GcDateTime control.
GcDateTime GcDateTime1 = new GcDateTime();
// Clear the default Fields
GcDateTime1.Fields.Clear();
// Sets the text of the DisplayNull property.
// The text will displayed when the GcDateTime control lost focus.
GcDateTime1.AlternateText.DisplayNull.Text = "Please Input here";
// Sets the ForeColor of the DisplayNull property.
// The text will displayed with this color.
GcDateTime1.AlternateText.DisplayNull.ForeColor = Color.Red;
// Sets the text of the Null property.
// The text will displayed when the GcDateTime control got focus.
GcDateTime1.AlternateText.Null.Text = "Now the value is null";
// Sets the ForeColor of the Null property.
// The text will displayed with this color.
GcDateTime1.AlternateText.Null.ForeColor = Color.Blue;
// Sets the DisplayEmptyEra.Text to a string for displaying when the value out of the range of Era.
GcDateTime1.AlternateText.DisplayEmptyEra.Text = "Value is out of Era range.";
// Sets the EmptyEra.Text to a string with a special format.
// The text will display the date time value according to the format "yyy/MM/dd"
// When the value is out of the range of era, the text will shown like "1009/07/02".
GcDateTime1.AlternateText.EmptyEra.Text = "{[yyy/MM/dd]}";
// Defines the fields by format string.
GcDateTime1.Fields.AddRange(@"ggg ee年MM月dd日 tt h:mm:ss");
// Defines the display fields by format string.
GcDateTime1.DisplayFields.AddRange(@"gg e年M月d日 tt h:mm:ss");
// Set Font of all DateLiteralField instances.
List<GrapeCity.Win.Editors.Fields.DateLiteralField> literalFields = GcDateTime1.Fields.FindAll<GrapeCity.Win.Editors.Fields.DateLiteralField>();
foreach (GrapeCity.Win.Editors.Fields.DateLiteralField field in literalFields)
{
field.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
}
// Sets the value of the GcDateTime to a DateTime value that out of Era.
GcDateTime1.Value = new System.DateTime(1009, 7, 2, 12, 21, 52, 0);
}
' Please use the following namespace
' Imports System.Windows.Forms;
' Imports GrapeCity.Win.Editors;
' Imports System.Drawing;
Public Sub SetAlternateTextSettings()
' Creates an instance of a GcDateTime control.
Dim GcDateTime1 As New GcDateTime()
' Clear the default Fields
GcDateTime1.Fields.Clear()
' Sets the text of the DisplayNull property.
' The text will displayed when the GcDateTime control lost focus.
GcDateTime1.AlternateText.DisplayNull.Text = "Please Input here"
' Sets the ForeColor of the DisplayNull property.
' The text will displayed with this color.
GcDateTime1.AlternateText.DisplayNull.ForeColor = Color.Red
' Sets the text of the Null property.
' The text will displayed when the GcDateTime control got focus.
GcDateTime1.AlternateText.Null.Text = "Now the value is null"
' Sets the ForeColor of the Null property.
' The text will displayed with this color.
GcDateTime1.AlternateText.Null.ForeColor = Color.Blue
' Sets the DisplayEmptyEra.Text to a string for displaying when the value out of the range of Era.
GcDateTime1.AlternateText.DisplayEmptyEra.Text = "Value is out of Era range."
' Sets the EmptyEra.Text to a string with a special format.
' The text will display the date time value according to the format "yyy/MM/dd"
' When the value is out of the range of era, the text will shown like "1009/07/02".
GcDateTime1.AlternateText.EmptyEra.Text = "{[yyy/MM/dd]}"
' Defines the fields by format string.
GcDateTime1.Fields.AddRange("ggg ee年MM月dd日 tt h:mm:ss")
' Defines the display fields by format string.
GcDateTime1.DisplayFields.AddRange("gg e年M月d日 tt h:mm:ss")
' Set Font of all DateLiteralField instances.
Dim literalFields As List(Of GrapeCity.Win.Editors.Fields.DateLiteralField) = GcDateTime1.Fields.FindAll(Of GrapeCity.Win.Editors.Fields.DateLiteralField)()
For Each field As GrapeCity.Win.Editors.Fields.DateLiteralField In literalFields
field.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134)
Next
' Sets the value of the GcDateTime to a DateTime value that out of Era.
GcDateTime1.Value = New System.DateTime(1009, 7, 2, 12, 21, 52, 0)
End Sub