HeaderPane
Main
Hide
Share Link
Print

InvalidBackColor Property, SftMask Class

Defines the background color while the contents are not valid.

Class: SftMask
Namespace: Softelvdm.SftMaskNET
Assembly: Softelvdm.SftMaskNET

Syntax

public Color InvalidBackColor { get; set; }
Public Property InvalidBackColor As Color

Value

The color, or Color.Empty to show invalid contents like valid ones.

The default value is Color.Empty.

Comments

Defines the background color while the contents are not valid.

Validity includes the SftMask.CustomValidation event, which the control raises when the contents change while an invalid color is set.

Examples

C# View entire sample code

        private void checkUnderline_CheckedChanged(object sender, EventArgs e) {
            foreach (SftMask field in fields)
                field.PromptUnderline = checkUnderline.Checked;
        }

        // Fields whose contents are incomplete or out of range are shown in other colors.
        private void checkInvalid_CheckedChanged(object sender, EventArgs e) {
            foreach (SftMask field in fields) {
                field.InvalidBackColor = checkInvalid.Checked ? Color.MistyRose : Color.Empty;
                field.InvalidForeColor = checkInvalid.Checked ? Color.DarkRed : Color.Empty;
            }
        }
    }
}

VB.NET View entire sample code

        For Each field As SftMask In fields
            field.PromptUnderline = CheckUnderline.Checked
        Next
    End Sub

    ' Fields whose contents are incomplete or out of range are shown in other colors.
    Private Sub CheckInvalid_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles CheckInvalid.CheckedChanged
        For Each field As SftMask In fields
            field.InvalidBackColor = If(CheckInvalid.Checked, Color.MistyRose, Color.Empty)
            field.InvalidForeColor = If(CheckInvalid.Checked, Color.DarkRed, Color.Empty)
        Next
    End Sub

End Class

See Also SftMask Class | Classes | SftMask/NET 3.0