Hide

SftButton/OCX 3.0 - Button Control

Display
Print

Text Property, SftButton Object

Defines the control's caption.

Syntax

Get

VB.NETText = object.Text As String
VBText = object.Text As String
C#.NETstring Text = object.Text;
VC++_bstr_t Text = object->Text;
_bstr_t Text = object->GetText();
CHRESULT object->get_Text(BSTR* Text);

Put

VB.NETobject.Text = Text As String
VBobject.Text = Text As String
C#.NETstring object.Text = Text;
VC++_bstr_t object->Text = Text;
void object->PutText(_bstr_t Text);
CHRESULT object->put_Text(BSTR Text);

object

A SftButton object.

Text

Defines the control's caption.

Comments

The Text property defines the control's caption.

The caption can include an accelerator key. By using the & character in the Text property, the following character becomes an accelerator key. If the user types Alt plus the defined accelerator key, the control receives the input focus and the Click event occurs.

For example, if the Text property is set to "&Help", the displayed caption will read "Help", i.e., the H is underlined. If the user types Alt+h, the Click event occurs. To display an & character use "&&".

If the AllowFocus property is set to False, the control does not support accelerator keys.

The text component of the button label can contain more than one line of text. By using carriage-return and line-feed characters, multiple lines can be defined.

The layout of the button label and the position and alignment of the text component are defined using the Orientation, TextAlignHorz and Image1AlignVert properties.

For detailed information on the use of the Orientation, Image1, Image1AlignHorz, Image1AlignVert, Image2, Image2AlignHorz, Image2AlignVert, Text, TextAlignHorz, TextAlignVert properties, please see "Button Label".

Examples

VB.NET

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
  Application.Exit()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  AxSftButton8.Text = "Two Lines" & vbCrLf & "of Text"
End Sub

VB6

Option Explicit

Private Sub Command1_Click()
    End
End Sub

Private Sub Form_Load()
    SftButton8.Text = "Two Lines" & vbCrLf & "of Text"
End Sub

C#

private void button1_Click(object sender, System.EventArgs e)
{
    Application.Exit();
}

private void Form1_Load(object sender, System.EventArgs e)
{
    axSftButton8.Text = "Two Lines\nof Text";
}

C++

    m_BoldFont.CreateFontIndirect(&lf);

    m_Title.SetFont(&m_BoldFont);

    // Get all ISftButton interface pointers for access to all
    // properties and methods (see Using SftButton/OCX with Visual C++
    // in the online help for more information)
    m_vButton8 = m_Button8.GetControlUnknown();
    m_vButton8->Text = _bstr_t(_T("Two Lines\nof Text"));

    return TRUE;  // return TRUE  unless you set the focus to a control
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

See Also SftButton Object | Object Hierarchy


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