Hide

SftButton/OCX 3.0 - Button Control

Display
Print

Pressed Property, SftButton Object

Defines whether the button is pressed (toggle button only).

Syntax

Get

VB.NETBoolean = object.Pressed As Boolean
VBBoolean = object.Pressed As Boolean
C#.NETbool Boolean = object.Pressed;
VC++VARIANT_BOOL Boolean = object->Pressed;
VARIANT_BOOL Boolean = object->GetPressed();
CHRESULT object->get_Pressed(VARIANT_BOOL* Boolean);

Put

VB.NETobject.Pressed = Boolean As Boolean
VBobject.Pressed = Boolean As Boolean
C#.NETbool object.Pressed = Boolean;
VC++VARIANT_BOOL object->Pressed = Boolean;
void object->PutPressed(VARIANT_BOOL Boolean);
CHRESULT object->put_Pressed(VARIANT_BOOL Boolean);

object

A SftButton object.

Boolean

Defines whether the button is pressed (toggle button only).

BooleanDescription
TrueThe button is pressed.
FalseThe button is released.

Comments

The Pressed property defines whether the button is pressed (toggle button only).

When using the Pressed property, the Click event does not occur.

The Toggle property must be set to True for this property to have an effect.

The drop down button portion is controlled by the equivalent DropDownPressed property.

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 ChangePicture_Button3()
    ' Change the pictures based on the button's Pressed status
    If AxSftButton3.Pressed Then
        AxSftButton3.Image1.NETImageObject = ImageList1.Images(1)
        AxSftButton3.Image2.NETImageObject = ImageList1.Images(0)
    Else
        AxSftButton3.Image1.NETImageObject = ImageList1.Images(0)
        AxSftButton3.Image2.NETImageObject = ImageList1.Images(1)
    End If
End Sub

Private Sub axSftButton3_ClickEvent(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxSftButton3.ClickEvent

VB6

        Set .Image1Pressed.Picture = PictureOn.Picture
        Set .Image1.Picture = PictureOff.Picture
    End With
End Sub

Private Sub ChangePicture_SftButton3()
    ' Change the pictures based on the button's Pressed status
    With SftButton3
        If .Pressed Then
            Set .Image1.Picture = PictureOn.Picture
            Set .Image2.Picture = PictureOff.Picture
        Else
            Set .Image1.Picture = PictureOff.Picture
            Set .Image2.Picture = PictureOn.Picture
        End If
    End With

C#

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

private void ChangePicture_Button3()
{
    // Change the pictures based on the button's Pressed status
    if (axSftButton3.Pressed)
    {
        axSftButton3.Image1.NETImageObject = imageList1.Images[1];
        axSftButton3.Image2.NETImageObject = imageList1.Images[0];
    } else {
        axSftButton3.Image1.NETImageObject = imageList1.Images[0];
        axSftButton3.Image2.NETImageObject = imageList1.Images[1];
    }

C++

    ASSERT(SUCCEEDED(hr));

    hr = pImg1->put_Picture(pPicDisp);
    ASSERT(SUCCEEDED(hr));

    bmp.DeleteObject();
    pPic = NULL;

    if (m_vButton3->Pressed)
        bmp.LoadBitmap(IDB_OFF);
    else
        bmp.LoadBitmap(IDB_ON);
    pictDesc.bmp.hbitmap = (HBITMAP) bmp.m_hObject;

    hr = ::OleCreatePictureIndirect(&pictDesc, IID_IPicture, TRUE, (void**)&pPic);
    ASSERT(SUCCEEDED(hr));

See Also SftButton Object | Object Hierarchy


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