'Declaration Public Property Appearance As AppearanceBase
public AppearanceBase Appearance {get; set;}
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinMaskedEdit Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button2.Click ' Following code sets different appearances on month, day and year portions ' of the masked edit control. ' Set the InputMask to a date mask. Me.ultraMaskedEdit1.InputMask = "mm/dd/yyyy" Me.ultraMaskedEdit1.Value = DateTime.Now ' Loop through all the sections. Dim i As Integer For i = 0 To Me.ultraMaskedEdit1.Sections.Count - 1 Dim section As SectionBase = Me.ultraMaskedEdit1.Sections(i) ' Print out the section type. Debug.WriteLine("Sections(" & i.ToString() & ") = " & section.GetType().Name) ' Set different appearances on month, day and year sections by checking ' the type of the section. If section.GetType() Is GetType(MonthSection) Then section.Appearance.ForeColor = Color.Red ElseIf section.GetType() Is GetType(DaySection) Then section.Appearance.ForeColor = Color.Green ElseIf section.GetType() Is GetType(YearSection) Then section.Appearance.ForeColor = Color.Blue End If Next End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinMaskedEdit; using System.Diagnostics; private void button2_Click(object sender, System.EventArgs e) { // Following code sets different appearances on month, day and year portions // of the masked edit control. // Set the InputMask to a date mask. this.ultraMaskedEdit1.InputMask = "mm/dd/yyyy"; this.ultraMaskedEdit1.Value = DateTime.Now; // Loop through all the sections. for ( int i = 0; i < this.ultraMaskedEdit1.Sections.Count; i++ ) { SectionBase section = this.ultraMaskedEdit1.Sections[i]; // Print out the section type. Debug.WriteLine( "Sections[" + i.ToString( ) + "] = " + section.GetType( ).Name ); // Set different appearances on month, day and year sections by checking // the type of the section. if ( section.GetType( ) == typeof( MonthSection ) ) { section.Appearance.ForeColor = Color.Red; } else if ( section.GetType( ) == typeof( DaySection ) ) { section.Appearance.ForeColor = Color.Green; } else if ( section.GetType( ) == typeof( YearSection ) ) { section.Appearance.ForeColor = Color.Blue; } } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2