Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

Alignment Property, SftMaskCaption Object

Defines the caption's alignment.

Syntax

Get

VB.NETAlign = object.Alignment As SftMaskAlignConstants
VBAlign = object.Alignment As SftMaskAlignConstants
C#.NETSftMaskAlignConstants Align = object.Alignment;
VC++enum SftMaskAlignConstants Align = object->Alignment;
enum SftMaskAlignConstants Align = object->GetAlignment();
CHRESULT object->get_Alignment(enum SftMaskAlignConstants* Align);

Put

VB.NETobject.Alignment = Align As SftMaskAlignConstants
VBobject.Alignment = Align As SftMaskAlignConstants
C#.NETSftMaskAlignConstants object.Alignment = Align;
VC++enum SftMaskAlignConstants object->Alignment = Align;
void object->PutAlignment(enum SftMaskAlignConstants Align);
CHRESULT object->put_Alignment(enum SftMaskAlignConstants Align);

object

A SftMaskCaption object.

Align

Defines the horizontal alignment of the caption label (Caption.Text) within the area available for the caption.

AlignValueDescription
alignSftMaskLeft0The text is left adjusted.
alignSftMaskCenter1The text centered.
alignSftMaskRight2The text is right adjusted.

Comments

The Alignment property defines the caption's alignment.

The built-in caption can be positioned on any side of the control (see Caption.Position). The AutoSize and Caption.SizePercent properties determine the size of the caption area.

Within the defined caption area, the caption's text is horizontally aligned using the Alignment property. Vertical alignment is defined using the VerticalAlignment property.

The caption area position and size are defined using a combination of the Caption.SizePercent or Caption.Width, Caption.Position and AutoSize properties. For a detailed description of the various combinations, please see the chapter Built-In Caption.

Examples

VB.NET

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    AxSftMask1.Mask = "(!0###!!) !1###!!\-!2####!!"
    AxSftMask1.Caption.Text = "&Phone Number: "
    AxSftMask1.Caption.SizePercent = 40
    AxSftMask1.Caption.Alignment = SftMaskAlignConstants.alignSftMaskRight
    AxSftMask1.Caption.Position = SftMaskPositionConstants.positionSftMaskLeft
    AxSftMask1.Caption.VerticalAlignment = SftMaskVerticalAlignConstants.valignSftMaskBaseline
    AxSftMask1.AutoSize = True
    AxSftMask1.Text = "9415058600"
    MsgBox("The area code is " & AxSftMask1.Contents.Value(0))
    MsgBox("The exchange is " & AxSftMask1.Contents.Value(1))
    MsgBox("The last 4 digits are " & AxSftMask1.Contents.Value(2))
    AxSftMask1.Contents.Value(2) = "8555"
End Sub

VB6

Private Sub Form_Load()
    SftMask1.Mask = "(!0###!!) !1###!!\-!2####!!"
    SftMask1.Caption.Text = "&Phone Number: "
    SftMask1.Caption.SizePercent = 40
    SftMask1.Caption.Alignment = alignSftMaskRight
    SftMask1.Caption.Position = positionSftMaskLeft
    SftMask1.Caption.VerticalAlignment = valignSftMaskBaseline
    SftMask1.AutoSize = True
    SftMask1.Text = "9415058600"
    MsgBox ("The area code is " & SftMask1.Contents.Value(0))
    MsgBox ("The exchange is " & SftMask1.Contents.Value(1))
    MsgBox ("The last 4 digits are " & SftMask1.Contents.Value(2))
    SftMask1.Contents.Value(2) = "8555"
End Sub

C#

private void Form1_Load(object sender, System.EventArgs e)
{
    axSftMask1.Mask = @"(!0###!!) !1###!!\-!2####!!";
    axSftMask1.Caption.Text = "&Phone Number: ";
    axSftMask1.Caption.SizePercent = 40;
    axSftMask1.Caption.Alignment = SftMaskAlignConstants.alignSftMaskRight;
    axSftMask1.Caption.Position = SftMaskPositionConstants.positionSftMaskLeft;
    axSftMask1.Caption.VerticalAlignment = SftMaskVerticalAlignConstants.valignSftMaskBaseline;
    axSftMask1.AutoSize = true;
    axSftMask1.Text = "9415058600";
    MessageBox.Show("The area code is " + axSftMask1.Contents.get_Value(0).ToString());
    MessageBox.Show("The exchange is " + axSftMask1.Contents.get_Value(1).ToString());
    MessageBox.Show("The last 4 digits are " + axSftMask1.Contents.get_Value(2).ToString());
    axSftMask1.Contents.set_Value(2, "8555");
}

C++

    CDialog::OnInitDialog();

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

    m_pMask1->Mask = _T("(!0###!!) !1###!!\\-!2####!!");
    m_pMask1->Caption->Text = _T("&Phone Number: ");
    m_pMask1->Caption->SizePercent = 40;
    m_pMask1->Caption->Alignment = alignSftMaskRight;
    m_pMask1->Caption->Position = positionSftMaskLeft;
    m_pMask1->Caption->VerticalAlignment = valignSftMaskBaseline;
    m_pMask1->AutoSize = VARIANT_TRUE;
    m_pMask1->Text = _T("9415058600");
    CString str;
    variant_t v = m_pMask1->Contents->Value[0];
    v.ChangeType(VT_BSTR);

See Also SftMaskCaption Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.