Library code snippets
Display animated GIFs in VB
While the Picture ActiveX control offers a great way to display
graphics, it only shows the first image in an animated GIF. To
display a fully animated GIF, without rebuilding the entire graphic
frame by frame, you can use the WebBrowser control (just keep in
mind that this control isn't available to machines without IE 3.0
or greater). To do so, select the Microsoft Internet Controls
component. When you do, the WebBrowser control appears on Visual
Basic's toolbar. Drop the control onto a form, then in the form's
Load() event place the following code:WebBrowser1.Navigate "C:Internetanim.gif"
Where the filespec points to a valid animated GIF path or URL. When
you run the program, Visual Basic displays the GIF.
Unfortunately, the WebBrowser also displays a right-hand scroll
bar--probably not what you want for a decorative image. Believe it
or not, you can turn this scrollbar off just like you would normally
via HTML, as in:WebBrowser1.Navigate "about:<html><body scroll='no'><img
src='D:Internetanim.gif'></img></body></html>"
Now when you run the form, Visual Basic displays the image sans
scrollbar.
Related articles
Related discussion
-
Regarding Visual Basic Programme
by manjunathsl2007 (0 replies)
-
how do you hide all in VB6
by CapnJack (1 replies)
-
Problem with Input File
by novavb6 (3 replies)
-
How to produce a txt file with a table??
by novavb6 (1 replies)
-
VB6 compatability from XP to Vista
by bronx (1 replies)
_ Margins set to 0
_ Pic loaded from Application path
WebBrowser1.Navigate "about:<html><body scroll='no' leftmargin='0' rightmargin='0' topmargin='0' bottommargin='0'><img src='" & App.Path & "\MyPic.gif'></img></body></html>"
Edit : I didn't see comments were extracted from Forum posts and App.Path was proposed yet ...
I have this same problem, i have been searching for months.
Can sum one who knows please respond or contact me.
I dont like how when you have a webbrowser, it has a border around the edges.
I dont know how to disable the border so its invisible.
Thanks.
Edit: I just noticed this is a old topic... hmmm i hope you still read this.
great code and tutorial. but the html is a little off. this should fix it.
WebBrowser1.Navigate "about:<html><body scroll='no'><img src='c:\image.gif'></img></body></html>"
I have try this, but I have the problem with the border.
How can I use the webbrowser control (Microsoft Internet Controls) without border (make hidden)?
I have try this, but I have the problem with the border.
How can I use the webbrowser control (Microsoft Internet Controls) without border ?
try this, use app.path to specify your app working directory or just write complete path to make it sure,you have access the right directory
Hello,
So if you write
WebBrowser1.Navigate "C:Internetanim.gif"
It works, but I couldn't find any syntax for putting it in the same directory as the pgm itself :
WebBrowser1.Navigate "Internetanim.gif" wont work
WebBrowser1.Navigate "\Internetanim.gif" wont work
WebBrowser1.Navigate ".\Internetanim.gif" wont work
WebBrowser1.Navigate "./Internetanim.gif" wont work
and so on...
Any idea ?
Froggy Jacques
This thread is for discussions of Display animated GIFs in VB.