// Please use the following namespace
// using System.Windows.Forms;
// using GrapeCity.Win.Editors;
// using System.Drawing;
public void SetAlternateTextSettings()
{
// Creates an instance of a GcTime control.
GcTime gcTime1 = new GcTime();
// Clear the default Fields
gcTime1.Fields.Clear();
// Sets the text of the DisplayNull property.
// The text will displayed when the GcTime control lost focus.
gcTime1.AlternateText.DisplayNull.Text = "Please Input here";
// Sets the ForeColor of the DisplayNull property.
// The text will displayed with this color.
gcTime1.AlternateText.DisplayNull.ForeColor = Color.Red;
// Sets the text of the Null property.
// The text will displayed when the GcTime control got focus.
gcTime1.AlternateText.Null.Text = "Now the value is null";
// Sets the ForeColor of the Null property.
// The text will displayed with this color.
gcTime1.AlternateText.Null.ForeColor = Color.Blue;
// Defines the fields by format string.
gcTime1.Fields.AddRange(@"h:mm:ss");
// Defines the display fields by format string.
gcTime1.DisplayFields.AddRange(@"h:mm:ss");
// Set Font of all DateLiteralField instances.
List<GrapeCity.Win.Editors.Fields.DateLiteralField> literalFields = gcTime1.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 GcTime to a TimeSpan value that out of Era.
gcTime1.Value = new System.TimeSpan(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 GcTime control.
Dim gcTime1 As New GcTime()
' Clear the default Fields
gcTime1.Fields.Clear()
' Sets the text of the DisplayNull property.
' The text will displayed when the GcTime control lost focus.
gcTime1.AlternateText.DisplayNull.Text = "Please Input here"
' Sets the ForeColor of the DisplayNull property.
' The text will displayed with this color.
gcTime1.AlternateText.DisplayNull.ForeColor = Color.Red
' Sets the text of the Null property.
' The text will displayed when the GcTime control got focus.
gcTime1.AlternateText.Null.Text = "Now the value is null"
' Sets the ForeColor of the Null property.
' The text will displayed with this color.
gcTime1.AlternateText.Null.ForeColor = Color.Blue
' Defines the fields by format string.
gcTime1.Fields.AddRange("h:mm:ss")
' Defines the display fields by format string.
gcTime1.DisplayFields.AddRange("h:mm:ss")
' Set Font of all DateLiteralField instances.
Dim literalFields As List(Of GrapeCity.Win.Editors.Fields.DateLiteralField) = gcTime1.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 GcTime to a TimeSpan value that out of Era.
gcTime1.Value = New System.TimeSpan(12, 21, 52, 0)
End Sub