HeaderPane
Main
Hide
Share Link
Print

BackColorInvalid Property, SftMask Object

Defines the control's background color when its contents are invalid.

Syntax

Get

C#System.Drawing.Color Clr = object.BackColorInvalid;
VB.NETClr = object.BackColorInvalid As System.Drawing.Color
C++OLE_COLOR Clr = object->BackColorInvalid;
OLE_COLOR Clr = object->GetBackColorInvalid();
CHRESULT object->get_BackColorInvalid(OLE_COLOR* Clr);

Put

C#System.Drawing.Color object.BackColorInvalid = Clr;
VB.NETobject.BackColorInvalid = Clr As System.Drawing.Color
C++OLE_COLOR object->BackColorInvalid = Clr;
void object->PutBackColorInvalid(OLE_COLOR Clr);
CHRESULT object->put_BackColorInvalid(OLE_COLOR Clr);

object

A SftMask object.

Clr

Defines the control's background color when its contents are invalid.

Comments

The BackColorInvalid property defines the control's background color when its contents are invalid (see Contents.Valid).

If the contents are valid, the BackColor property defines the control's default background color.

Text that is selected uses the SelectBackColor property instead. The caption's background color is defined using the Caption.BackColor property.

If Windows themes are used, this property may have no effect depending on the ThemeStyle property setting.

Examples

C# View entire sample code

private void Form1_Load(object sender, System.EventArgs e)
{
    axSftMask1.Caption.SizePercent = 33;
    axSftMask1.Caption.Text = "&Text:";
    axSftMask1.Mask = @"\(###\) ###\-####";
    axSftMask1.Alignment = SftMaskAlignConstants.alignSftMaskLeft;
    axSftMask1.BackColorInvalid = Color.Red;
    axSftMask1.ForeColorInvalid = Color.White;
    axSftMask1.FormattedText = "Please enter a telephone number";
}

private void axSftMask1_Change(object sender, System.EventArgs e)
{
    if (axSftMask1.Contents.Valid) {
        MessageBox.Show("This is a valid phone number.");
    } else {

VB.NET View entire sample code

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    AxSftMask1.Caption.SizePercent = 33
    AxSftMask1.Caption.Text = "&Text:"
    AxSftMask1.Mask = "\(###\) ###\-####"
    AxSftMask1.Alignment = SftMaskAlignConstants.alignSftMaskLeft
    AxSftMask1.BackColorInvalid = Color.Red
    AxSftMask1.ForeColorInvalid = Color.White
    AxSftMask1.FormattedText = "Please enter a telephone number"
End Sub

Private Sub AxSftMask1_Change(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftMask1.Change
    If AxSftMask1.Contents.Valid Then
        MsgBox("This is a valid phone number.")
    Else
        If AxSftMask1.Contents.Empty Then
            AxSftMask1.FormattedText = "Please enter a telephone number"

C++ View entire sample code

    m_pMask1 = m_Mask1.GetControlUnknown();
    _ASSERT(m_pMask1 != NULL);

    m_pMask1->Caption->SizePercent = 33;
    m_pMask1->Caption->Text = _T("&Text:");
    m_pMask1->Mask = _T("\\(###\\) ###\\-####");
    m_pMask1->Alignment = alignSftMaskLeft;
    m_pMask1->BackColorInvalid = RGB(255,0,0);
    m_pMask1->ForeColorInvalid = RGB(255,255,255);
    m_pMask1->FormattedText = _T("Please enter a telephone number");

    return TRUE;
}

void CProject1Dlg::OnChangeSftMask1()
{

See Also SftMask Object | Object Hierarchy


Last Updated 11/15/2026 - (email)
© 2026 Softel vdm, Inc.