Link to home
Start Free TrialLog in
Avatar of vivekgreat
vivekgreat

asked on

Animation in vb

I have just ventured into VB.I want an animation(like a rotating ball or even a text that's scrolling) to be running
continuosly in the form that i load.For instance if i want
the company's logo to be displayed always in the package.How do i go about doing it.
This may seem simple for some of you.But i am very anxious to know it.
bye
vivek

Avatar of mikezang
mikezang

Make a group of small pictures(icon) with continous image, loop to display these pictures, you will get a animation.
Mike
In VB, there is a smaple REDTOP, you can view it.
Mike
ASKER CERTIFIED SOLUTION
Avatar of mikezang
mikezang

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
in a from 'Smooth scroll graphics and text up a window. This effect is similar to the closing credits of a movie. The example shows the basics of scrolling text up a form. It can easily be modified to scroll graphics on a form or other controls (ex: a picture box).




       
'***************************************************************

' Name: Smooth Scroll Graphics and Text

' Description:Smooth scroll graphics and text up a window. This e

'     ffect is similar

'to the closing credits of a movie. The example shows the basics of
'
'scrolling text up a form. It can easily be modified to scroll graphics
'
'on a form or other controls (ex: a picture box).

' By: MO

'

'

' Inputs:None

'

' Returns:None

'

'Assumes:Create a new project. Add picture box to the form. Renam

'     e the picture

'box to P1. Add a timer to the form. Add the code listed below to the
'
'
'
'form.

'

'Side Effects:None

'

'Code provided by Planet Source Code(tm) (http://www.PlanetSource

'     Code.com) 'as is', without warranties as to performance, fitness,

'     merchantability,and any other warranty (whether expressed or impl

'     ied).

'***************************************************************





Sub Form_Load()



    P1.AutoRedraw = True

    P1.Visible = False

    P1.FontSize = 12

    P1.ForeColor = &HFF0000

    P1.BackColor = BackColor

    P1.ScaleMode = 3

centerIT P1, "Hi!!!"

    centerIT P1, "Scroll Test..."

    ScaleMode = 3

    theleft = (ScaleWidth - P1.TextWidth("Scroll Test...")) / 2

    thetop = ScaleHeight

    p1hgt = P1.ScaleHeight

    p1wid = P1.ScaleWidth

    Timer1.Enabled = True

    Timer1.Interval = 10

End Sub





Sub Timer1_Timer()



    X% = BitBlt(hDC, theleft, thetop, p1wid, p1hgt, P1.hDC, 0, 0, &HCC0020)

    thetop = thetop - 1



    If thetop < -p1hgt Then

        Timer1.Enabled = False

        Txt$ = "Finished With Scrolling"

        CurrentY = ScaleHeight / 2

        CurrentX = (ScaleWidth - TextWidth(Txt$)) / 2

        Print Txt$

    End If



End Sub

in a module
'***************************************************************

'Windows API/Global Declarations for :Smooth Scroll Graphics and

'     Text

'***************************************************************

'declares



Declare Function BitBlt Lib "GDI" (ByVal hDestDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer, ByVal YSrc As Integer, ByVal dwRop As Long) As Integer

    Dim thetop As Long

    Dim p1hgt As Long

    Dim p1wid As Long

    Dim theleft As Long

Avatar of vivekgreat

ASKER

I have tried out what u said, but i get the error 'Error 48-File
not found:GDI'.Does it mean that the Dll is not present in the
specified path.I am not a expert in VB.
Pls advice
thanx
vivek

where the error appears
?

the error appears when i run the project.the error appears in the
sub timer1_timer()
---> X% = BitBlt(hDC, theleft, thetop, p1wid, p1hgt, P1.hDC, 0, 0, &HCC0020)
why does the error occur?
bye
vivek

did you put the following in a module:

in a module
'***************************************************************

'Windows API/Global Declarations for :Smooth Scroll Graphics and

'     Text

'***************************************************************

'declares



Declare Function BitBlt Lib "GDI" (ByVal hDestDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer, ByVal YSrc As Integer, ByVal dwRop As Long) As Integer

    Dim thetop As Long

    Dim p1hgt As Long

    Dim p1wid As Long

    Dim theleft As Long
Same error!
actually , i don't know ,

but , try to ask Planet Source Code

unfortunatly , i don't have the exact link of the project ,
but you have the programmer name , and the title

wish luck to you