Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

Font Property, SftMask Object

Defines the font used to display text while editing.

Syntax

Get

VB.NETrefFontObj = object.Font As System.Drawing.Font
VBSet refFontObj = object.Font As IFontDisp
C#.NETSystem.Drawing.Font refFontObj = object.Font;
VC++IFontDisp* refFontObj = object->GetFont();
CHRESULT object->get_Font(IFontDisp** refFontObj);

Put

VB.NETobject.let_Font(ByVal refFontObj As System.Drawing.Font)
VBobject.Font = refFontObj As IFontDisp
C#.NETvoid object.let_Font(System.Drawing.Font refFontObj);
VC++void object->PutFont(IFontDisp* refFontObj);
CHRESULT object->put_Font(IFontDisp* refFontObj);

PutRef

VB.NETobject.Font = refFontObj As System.Drawing.Font
VBSet object.Font = refFontObj As IFontDisp
C#.NETSystem.Drawing.Font object.Font = refFontObj;
VC++void object->PutRefFont(IFontDisp* refFontObj);
CHRESULT object->putref_Font(IFontDisp* refFontObj);

object

A SftMask object.

refFontObj

Defines the font used to display text while editing.

Comments

The Font property defines the font used to display text while editing.

The PromptUnderline and PromptUnderlineNoFocus properties can be used to further underline input fields using the defined font, allowing users to distinguish between input fields and literal characters.

The font used for the caption is defined using the Caption.Font property.

If the AutoSize property is set to True, the height of the control is automatically adjusted to allow the complete text to be displayed without being clipped vertically.

Using PutRef (see Syntax above) the control will use the reference to the Font object. If the Font object is later changed, this will also affect the font used by the control. Using Put instead, causes the control to create a copy of the Font object. If the Font object is later changed, this will not affect the font used by the control as it uses a copy of the object. Because of the additional overhead and the increased resource use of Put, PutRef is the preferred method.

Examples

VB.NET

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim BoldFont As New Font("Times New Roman", 12, FontStyle.Bold)
    AxSftMask1.Font = BoldFont
    Dim NormFont As New Font("Times New Roman", 12, FontStyle.Regular)
    AxSftMask1.Caption.Font = OLECvt.ToIFontDisp(NormFont)

    Dim CalcObj As SftMaskCalculator
    AxSftMask1.Caption.SizePercent = 33
    AxSftMask1.Caption.Text = "&Amount:"
    AxSftMask1.Mask = "| $C-,8.2"
    AxSftMask1.Alignment = SftMaskAlignConstants.alignSftMaskRight
    AxSftMask1.EntrySelect = SftMaskEntrySelectConstants.entrySftMaskSelectEnd
    AxSftMask1.Text = 10
    CalcObj = AxSftMask1.Calculator
    CalcObj.Lines = 12
    CalcObj.FracDigits = 2

VB6

Private Sub Form_Load()
    SftMask1.Font.Name = "Times New Roman"
    SftMask1.Font.Bold = True
    SftMask1.Font.Size = 12

    SftMask1.Caption.Font.Name = "Times New Roman"
    SftMask1.Caption.Font.Bold = False
    SftMask1.Caption.Font.Size = 12

    Dim CalcObj As SftMaskLib70.SftMaskCalculator
    SftMask1.Caption.SizePercent = 33
    SftMask1.Caption.Text = "&Amount:"
    SftMask1.Mask = "| $C-,8.2"
    SftMask1.Alignment = alignSftMaskRight
    SftMask1.EntrySelect = entrySftMaskSelectEnd
    SftMask1.Text = 10

C#

private void Form1_Load(object sender, System.EventArgs e)
{
    Font BoldFont = new Font("Times New Roman", 12, FontStyle.Bold);
    axSftMask1.Font = BoldFont;
    Font NormFont = new Font("Times New Roman", 12, FontStyle.Regular);
    axSftMask1.Caption.Font = OLECvt.ToIFontDisp(NormFont);

    SftMaskCalculator CalcObj = axSftMask1.Calculator;

    axSftMask1.Caption.SizePercent = 33;
    axSftMask1.Caption.Text = "&Amount:";
    axSftMask1.Mask = "| $C-,8.2";
    axSftMask1.Alignment = SftMaskAlignConstants.alignSftMaskRight;
    axSftMask1.EntrySelect = SftMaskEntrySelectConstants.entrySftMaskSelectEnd;
    axSftMask1.Text = "10";

C++

BOOL CProject1Dlg::OnInitDialog()
{
    CDialog::OnInitDialog();

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

    IFontDispPtr pFontDisp = m_pMask1->GetFont();
    IFontPtr pFont = pFontDisp;
    pFont->put_Name(L"Times New Roman");
    pFont->put_Bold(TRUE);
    CY size;
    size.int64 = 12*10000L; //12 point font
    pFont->put_Size(size);

    pFontDisp = m_pMask1->Caption->GetFont();

See Also SftMask Object | Object Hierarchy


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