CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Animated Gifs

  1. #1
    Join Date
    Aug 1999
    Location
    India
    Posts
    6

    Animated Gifs

    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


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: Animated Gifs

    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
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

  3. #3
    Join Date
    Jun 1999
    Location
    England
    Posts
    86

    Re: Animated Gifs

    Are you sure you don't want a third party dll. Even if it's free?


  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Animated Gifs

    ' 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
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured