Hide

SftButton/OCX 3.0 - Button Control

Display
Print

Font Property, SftButton Object

Defines the font used to display text.

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 SftButton object.

refFontObj

Defines the font used to display text. For information about font properties, please visit the applicable section "Using SftButton/OCX with ...".

Comments

The Font property defines the font used to display text.

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

    ' Update the button bitmap every so often to get the
    ' spinning globe effect
    SetImage()
End Sub

Private Sub AxSftButton1_HoverOn(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftButton1.HoverOn
    ' The cursor is over the button, change the font
    ' and button text
    AxSftButton1.Font = New Font(AxSftButton1.Font, FontStyle.Underline)
    AxSftButton1.Text = "Click Me, Please"
End Sub

Private Sub AxSftButton1_HoverOff(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftButton1.HoverOff
    ' The cursor has left the button, change the font
    ' and button text back to their original settings
    AxSftButton1.Font = New Font(AxSftButton1.Font, FontStyle.Regular)

VB6

Private Sub CloseButton_Click()
    End
End Sub

Private Sub SftButton1_HoverOn()
    ' The cursor is over the button, change the font
    ' and button text
    SftButton1.Font.Underline = True
    SftButton1.Text = "Click Me, Please"
End Sub

Private Sub SftButton1_HoverOff()
    ' The cursor has left the button, change the font
    ' and button text back to their original settings
    SftButton1.Font.Underline = False
    SftButton1.Text = "Click Me"

C#

{
    Application.Exit();
}

private void axSftButton1_HoverOn(object sender, System.EventArgs e)
{
    // The cursor is over the button, change the font
    // and button text
    axSftButton1.Font = new Font(axSftButton1.Font, FontStyle.Underline);
    axSftButton1.Text = "Click Me, Please";
}

private void axSftButton1_HoverOff(object sender, System.EventArgs e)
{
    // The cursor has left the button, change the font
    // and button text back to their original settings

C++

    CDialog::OnTimer(nIDEvent);
}

void CSpecialDlg::OnHoverOnSftbtn1()
{
    // The cursor is over the button, change the font
    // and button text
    IFontPtr pFont = m_vButton1->GetFont();
    pFont->put_Underline(TRUE);
    m_vButton1->Text = _bstr_t("Click Me, Please");

}

void CSpecialDlg::OnHoverOffSftbtn1()
{
    // The cursor has left the button, change the font

See Also SftButton Object | Object Hierarchy


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