Hide

SftButton/OCX 3.0 - Button Control

Display
Print

AVIPlay Method, SftButton Object

Defines the animation used as a button picture component.

Syntax

VB.NETSuccess = object.AVIPlay(ByVal PictureNumber As Short, ByVal Filename As String, ByVal StartFrame As Integer, ByVal EndFrame As Integer) As Boolean
VBSuccess = object.AVIPlay(ByVal PictureNumber As Integer, ByVal Filename As String, ByVal StartFrame As Long, ByVal EndFrame As Long) As Boolean
C#.NETbool Success = object.AVIPlay(short PictureNumber, string Filename, int StartFrame, int EndFrame);
VC++VARIANT_BOOL Success = object->AVIPlay(short PictureNumber, _bstr_t Filename, long StartFrame, long EndFrame);
CHRESULT object->raw_AVIPlay(short PictureNumber, BSTR Filename, long StartFrame, long EndFrame, VARIANT_BOOL* Success);

object

A SftButton object.

PictureNumber

Describes the graphic position to be used to display the animation.

ValueDescription
0The first graphic is used. The graphic defined using the Image1 property is replaced by the animation.
1The second graphic is used. The graphic defined using the Image2 property is replaced by the animation.

Filename

Specifies the filename of the file containing the AVI clip to display. To load an animation from a resource instead, use the AVIPlayResource method.

StartFrame

Specifies the first frame number of the animation with which the display starts.

EndFrame

Specifies the last frame number of the animation with which the display ends. If -1 is specified, the animation runs continuously.

Success

Returns True if the animation is successfully loaded from the specified file Filename, otherwise False is returned.

Comments

The AVIPlay method defines the animation used as a button picture component.

The AVIPlay method loads the animation from a file. AVIPlayResource can be used to load it from a module's resources.

Animations can only be defined at run-time. If a file is used to load an animation, this file must be distributed with an application.

The AVITransparent property can be used to define the transparency of the animation.

The Windows Animation control is used (SysAnimate32) so only silent AVI clips without sound can be used. If an AVI clip contains sound, the AVIPlay and AVIPlayResource methods will fail and return False.

The layout of the button label and the position and alignment of the picture components are defined using the Orientation, Image1AlignHorz, Image1AlignVert, Image2AlignHorz and Image2AlignVert properties.

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
    ' Define all animations at run-time using the AVIPlay method
    AxSftButtonSearch.AVIPlay(1, "..\Search.avi", 0, -1)
    AxSftButtonFind.AVIPlay(1, "..\FindComp.avi", 0, -1)
    AxSftButtonDownload.AVIPlay(1, "..\Download.avi", 0, -1)
End Sub

VB6

Option Explicit

Private Sub CloseButton_Click()
    End
End Sub

Private Sub Form_Load()
    ' Define all animations at run-time using the AVIPlay method
    SftButtonSearch.AVIPlay 1, ".\Search.avi", 0, -1
    SftButtonFind.AVIPlay 1, ".\FindComp.avi", 0, -1
    SftButtonDownload.AVIPlay 1, ".\Download.avi", 0, -1
End Sub

C#

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

private void Form1_Load(object sender, System.EventArgs e)
{
    // Define all animations at run-time using the AVIPlay method
    axSftButtonSearch.AVIPlay(1, "..\\Search.avi", 0, -1);
    axSftButtonFind.AVIPlay(1, "..\\FindComp.avi", 0, -1);
    axSftButtonDownload.AVIPlay(1, "..\\Download.avi", 0, -1);
}

C++

    TCHAR szPath[_MAX_PATH];

    GetModuleFileName(AfxGetApp()->m_hInstance, szModule, sizeof(szModule)/sizeof(TCHAR));
    _tsplitpath(szModule, szDrive, szPath, NULL, NULL);

    // Define all animations at run-time using the AVIPlay method
    // NOTE! If you are rebuilding this sample, you'll have to move the AVI files into the same folder as your executable
    _tmakepath(szModule, szDrive, szPath, _T("Search.avi"), NULL);
    m_vSearchButton->AVIPlay(1, _bstr_t(szModule), 0, -1);
    _tmakepath(szModule, szDrive, szPath, _T("FindComp.avi"), NULL);
    m_vFindButton->AVIPlay(1, _bstr_t(szModule), 0, -1);
    _tmakepath(szModule, szDrive, szPath, _T("Download.avi"), NULL);
    m_vDownloadButton->AVIPlay(1, _bstr_t(szModule), 0, -1);

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

See Also SftButton Object | Object Hierarchy


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