Hide

SftButton/OCX 3.0 - Button Control

Display
Print

Images Sample (VB6)

This sample illustrates button states and images.

The source code is located at C:\Program Files (x86)\Softelvdm\SftButton OCX 3.0\Samples\VB6\Images\Form1.frm or C:\Program Files\Softelvdm\SftButton OCX 3.0\Samples\VB6\Images\Form1.frm (on 32-bit Windows versions).

Option Explicit

Dim savedWidth As Integer
Dim savedHeight As Integer
Dim savedYPos As Long

Private Sub Form_Load()
    ' save the button size to demonstrate auto-sizing
    savedWidth = SftButton2.Width
    savedHeight = SftButton2.Height
    savedYPos = SftButton2.Top

    ' initialize a SftButton control to look like a check box
    SftButtonCheck.BorderAlways = False
    SftButtonCheck.AutoSize = autosizeSftButtonLeftCenter
    SftButtonCheck.Bounce = bounceSftButtonNo
    SftButtonCheck.ButtonStyle = styleSftButtonNone
    SftButtonCheck.ClickStyle = clickstyleSftButtonPictures
    SftButtonCheck.HoverStyle = hoverstyleSftButtonExact
    SftButtonCheck.Image1.Appearance = sftImageCheckboxYes
    SftButtonCheck.Text = "A SftButton control that looks like a check box with a caption"
    SftButtonCheck.ShowFocus = False
End Sub

Private Sub Check1_Click()
    ' enable/disable the control so the image changes
    SftButton1.Enabled = (Check1.Value = 0)
End Sub

Private Sub Check2_Click()
    ' resize the control
    If Check2.Value Then
        SftButton2.AutoSize = autosizeSftButtonLeftCenter
    Else
        SftButton2.AutoSize = autosizeSftButtonNone
        SftButton2.Width = savedWidth
        SftButton2.Height = savedHeight
        SftButton2.Top = savedYPos
    End If
End Sub

Private Sub CloseButton_Click()
    End
End Sub

Private Sub SftButtonCheck_Click()
    ' toggle the check box
    If SftButtonCheck.Image1.Appearance = sftImageCheckboxYes Then
        SftButtonCheck.Image1.Appearance = sftImageCheckboxNo
    Else
        SftButtonCheck.Image1.Appearance = sftImageCheckboxYes
    End If
End Sub

Private Sub SftButtonCheck_DblClick()
    SftButtonCheck_Click
End Sub

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