Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Animated GIF in Picture Box

Posted on 2004-08-04
4
Medium Priority
?
475 Views
Last Modified: 2008-03-04
Hi, I need a way to display an Animated GIF for some presentation software...

I can't use the web browser control because it doesn't allow me to trigger the form_click events etc... and I don't want to use an image box, I want a Picture box...

I also don't want a commercial OCX... and would like to basically copy frames from an animated gif intoa  picture box
0
Comment
Question by:matthew1471
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 18

Expert Comment

by:JR2003
ID: 11721551
Easy!

1. Place a WebBrowser control on your form
2. Place a PictureBox on your form. This will cover the scroll bar on your WebBrowser control
3. Pleace the following code in the form load event:

Private Sub Form_Load()

    Const SBAR_WIDTH = 17
    Const BORDER_WIDTH = 2
   
    Dim fname As String
    Dim w As Single
    Dim h As Single
    Dim l As Single
    Dim t As Single

    SetFormIcon Me
   
    ' Get the filename.
    fname = App.Path
    If Right$(fname, 1) <> "\" Then fname = fname & "\"
    fname = fname & "MyAnimatedGif.gif"
    'or
    fname = "C:\MyAnimatedGif.gif"

    With WebBrowser1
        .Navigate fname
        w = ScaleX(SBAR_WIDTH, vbPixels, ScaleMode)
        h = .Height - ScaleX(2 * BORDER_WIDTH, vbPixels, ScaleMode)
        l = .Left + WebBrowser1.Width - ScaleX(SBAR_WIDTH + BORDER_WIDTH, vbPixels, ScaleMode)
        t = .Top + ScaleY(BORDER_WIDTH, vbPixels, ScaleMode)
    End With
   
    With Picture1
        ' Cover the scroll bar.
        .BorderStyle = vbBSNone
        .BackColor = vbWindowBackground
        .Move l, t, w, h
        .ZOrder
    End With

End Sub
0
 
LVL 18

Accepted Solution

by:
JR2003 earned 300 total points
ID: 11721793
oops sorry I didn't see that you didn't want to use a WebBrowser control!
It is possible to do it without one but the code is a lot more detailed and not as stable and prone to flicker on large gifs.
email me if you want a copy.



0
 
LVL 18

Assisted Solution

by:Sethi
Sethi earned 200 total points
ID: 11722212
0
 
LVL 3

Author Comment

by:matthew1471
ID: 12024865
I managed to solve this problem myself, I created an OCX using the WebBrowser control..and found a site on how to kill the right click menu...

The Animated gifs sometimes display *very* poorly.. but that is actually down to Microsoft's fault.

I have given JR2003 the points because I am consious of the number of questions i've ended up solving myself, it's going to annoy people... and technically the solution was the WebBrowser control....

Have a nice weekend

If anyone wants the code I have, e-mail me
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question