// Please use the following namespace
// using System.Windows.Forms;
// using GrapeCity.Win.Editors;
// using System.Drawing;
public void SetAlternateTextSettings()
{
// Creates an instance of a GcMask control.
GcMask gcMask1 = new GcMask();
gcMask1.Fields.AddRange(@"〒\D{3}-\D{4}");
// Sets the text of the DisplayNull property.
// The text will displayed when the GcMask control lost focus.
gcMask1.AlternateText.DisplayNull.Text = "{#}";
// Sets the ForeColor of the DisplayNull property.
// The text will displayed with this color.
gcMask1.AlternateText.DisplayNull.ForeColor = Color.Gray;
// Sets the text of the Null property.
// The text will displayed when the GcMask control got focus.
gcMask1.AlternateText.Null.Text = "Please input postal here";
// Sets the ForeColor of the Null property.
// The text will displayed with this color.
gcMask1.AlternateText.Null.ForeColor = Color.Gray;
// Set forecolor for all literal fields.
List<GrapeCity.Win.Editors.Fields.MaskLiteralField> literalFields = gcMask1.Fields.FindAll<GrapeCity.Win.Editors.Fields.MaskLiteralField>();
foreach (GrapeCity.Win.Editors.Fields.MaskLiteralField field in literalFields)
{
field.ForeColor = Color.Red;
}
}
' Please use the following namespace
' Imports System.Windows.Forms;
' Imports GrapeCity.Win.Editors;
' Imports System.Drawing;
Public Sub SetAlternateTextSettings()
' Creates an instance of a GcMask control.
Dim gcMask1 As New GcMask()
gcMask1.Fields.AddRange("〒\D{3}-\D{4}")
' Sets the text of the DisplayNull property.
' The text will displayed when the GcMask control lost focus.
gcMask1.AlternateText.DisplayNull.Text = "{#}"
' Sets the ForeColor of the DisplayNull property.
' The text will displayed with this color.
gcMask1.AlternateText.DisplayNull.ForeColor = Color.Gray
' Sets the text of the Null property.
' The text will displayed when the GcMask control got focus.
gcMask1.AlternateText.Null.Text = "Please input postal here"
' Sets the ForeColor of the Null property.
' The text will displayed with this color.
gcMask1.AlternateText.Null.ForeColor = Color.Gray
' Set forecolor for all literal fields.
Dim literalFields As List(Of GrapeCity.Win.Editors.Fields.MaskLiteralField) = gcMask1.Fields.FindAll(Of GrapeCity.Win.Editors.Fields.MaskLiteralField)()
For Each field As GrapeCity.Win.Editors.Fields.MaskLiteralField In literalFields
field.ForeColor = Color.Red
Next
End Sub