Click to See Complete Forum and Search --> : Animated Gifs


vkm
October 8th, 1999, 12:50 PM
How do I control a animated gif. I mean I want to include an animated gif in my form how do i do it. Simply using Image Control makes it still, it does not show any animation.

I don't want to use any 3rd part DLL.

Can anyone please let me know about it??

Regards,

Vk

Aaron Young
October 8th, 1999, 01:07 PM
There is a way to Fake it without any 3rd Party Controls, you can use the Microsoft Internet Controls Webbrowser Control within a Picturebox.

Take a Form with the following controls and paste this code into it;
A CommonDialogbox, a Command Button, a Picturebox & WebBrowser Control (Drawn within the Picturebox Container)..

private Sub Command1_Click()
on error GoTo UserCancelled
With CommonDialog1
.DialogTitle = "Select an Animated Gif.."
.Filter = "GIFs|*.gif"
.CancelError = true
.ShowOpen
WebBrowser1.Navigate .FileName
WebBrowser1.Move -ScaleX(12, vbPixels, vbTwips), -ScaleY(20, vbPixels, vbTwips), Screen.Width, Screen.Height
Picture1 = LoadPicture(.FileName)
Picture1.AutoSize = true
End With
UserCancelled:
End Sub





Aaron Young
Analyst Programmer
adyoung@win.bright.net
aarony@redwingsoftware.com

Andyb
June 12th, 2001, 02:35 PM
Are you sure you don't want a third party dll. Even if it's free?

Iouri
June 12th, 2001, 02:46 PM
' An example of How to animate a bitmap inside a button
'add control -> Microsoft Picture Clip control 6.0



Private Sub Form_Load()

'----- Set the PictureClip objects ( objects pctLeft and pctRight)

'Load pictures
pctLeft.Picture = LoadPicture(App.Path & "\left.bmp")
pctRight.Picture = LoadPicture(App.Path & "\right.bmp")

'Set Cols and Rows
pctLeft.Cols = 2
pctLeft.Rows = 2
pctRight.Cols = 2
pctRight.Rows = 2

'Enable the timer, tmrMrAnimator
tmrMrAnimator.Enabled = True

'Set timers speer interval 100 = 0.10 sec
tmrMrAnimator.Interval = 100

End Sub

Private Sub tmrMrAnimator_Timer()

Static MrLooper As Byte

'If counter is the last image then counter sets to first image
'Else, just carry on counting
If MrLooper = 3 Then
MrLooper = 0
Else
MrLooper = MrLooper + 1
End If

'Load images into buttons
cmdLeft.Picture = pctLeft.GraphicCell(MrLooper)
cmdRight.Picture = pctRight.GraphicCell(MrLooper)

End Sub


Iouri Boutchkine
iouri@hotsheet.com