Introduction/Problem
Well this is a common problem, VB does NOT support GIF's in the Applet, many of you ( I suppose ) make an array of pictureboxes and make still images loaded in them and then in a timer you make the still images to change and well its confusing even to say it, and much more confusing to make! it will take like 8 to 10 lines to just make an animation of 2 frames only! so imagine to make a long GIF! I found this 'secret' and all its going to take is 10 lines! and instead you can have a GIF with unlimited frames and make it with just 10 lines!!
Solution
Start a new Project and select "Standard EXE" as follows:-
Save your project somewhere
how?
see below:-
Add a Picturebox ( Picture1 ) and a web browser control.
HOW?
See this image below

a dialog box will be displayed scroll down till you find "Microsoft Internet Controls" tick it and press OK here is an image to explain better:-

and instead of WebBrowser1 rename it to Animation
and make a GIF image in the same directory where you saved the project and rename it to image.gif
Ok so now make the following code:-
Code:
Private Sub Form_Load()
Dim loc As String
Dim Source As String
loc = App.Path & "\image.gif"
Picture1.Visible = False
Picture1.AutoSize = True
Picture1.Picture = LoadPicture(loc)
Animation.Width = Picture1.Width
Animation.Height = Picture1.Height
Source = "about:" & "<html>" & "<body leftMargin=0 topMargin=0 marginheight=0 marginwidth=0 scroll=no>" & "<img src=""" & loc & """></img></body></html>"
Animation.Navigate Source
End Sub
Code Explanation
Code:
Dim loc As String
Dim Source As String
Here we are declaring 2 variables loc will be the location of the gif and Source will be some HTML code, dont worry if you dont know HTML! you dont need to because I did it for you
Code:
loc = App.Path & "\image.gif"
Here we are asigning the varible loc to the image path, App.path is the location of the project/app and "\image.gif" is the name of the image
Code:
Picture1.Visible = False
Picture1.AutoSize = True
Picture1.Picture = LoadPicture(loc)
Well here the code talks on its own
Here we are hiding the picturebox and making it to AutoSize (will take the size of the picture you load (image.gif)) and in the last step we are loading the picture
Code:
Animation.Width = Picture1.Width
Animation.Height = Picture1.Height
Here we are making the Webbrowser to take the height and width of the picture1, therefore the size of the GIF!
Code:
Source = "about:" & "<html>" & "<body leftMargin=0 topMargin=0 marginheight=0 marginwidth=0 scroll=no>" & "<img src=""" & loc & """></img></body></html>"
This is the HTML code that you will need to display the picture!
Code:
Animation.Navigate Source
here we are telling the Webbrowser to execute the Source code!
How does this work?
Simple Just place the browser control where you want to make the picture to appear
Complete Source Code:-
Well I included the FULL source code its an attachment, its the complete project just compile and have fun
IMPORTANT NOTE
With this way if you are going to distribute your application you NEED to distribute the picture TOO!!
Ending:-
If you have any questions/problems/feedback pls post here and I will sureley Help you!
So I'm waiting for your feedback
Ow and if you want me to make you some tutorials request what you want and I will see what I can do! I will be happy making some tuts here!
Tcm9669