Lost Password?

Go Back   CodeCall Programming Forum > Software Development > Tutorials > VB Tutorials

VB Tutorials Visual Basic Tutorials and Code

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-21-2006, 11:31 AM
TcM's Avatar   
TcM TcM is online now
Moderator
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 7,329
Rep Power: 66
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
Exclamation VB 6.0: Tutorial, How to make a GIF in your application

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
Attached Files To view attachments your post count must be 1 or greater. Your post count is 0 momentarily.

Last edited by Jordan; 10-02-2006 at 11:44 AM. Reason: Picture Location Change
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-03-2007, 05:05 AM
AfTriX AfTriX is offline
Programming God
 
Join Date: Jan 2007
Location: Sri Lanka
Posts: 596
Rep Power: 0
AfTriX is an unknown quantity at this point
Default

Nice work buddy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-03-2007, 06:25 AM
TcM's Avatar   
TcM TcM is online now
Moderator
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 7,329
Rep Power: 66
TcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud ofTcM has much to be proud of
Default

Quote:
Originally Posted by AfTriX View Post
Nice work buddy
Thanks Just a trick of the trade!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-03-2007, 06:34 AM
AfTriX AfTriX is offline
Programming God
 
Join Date: Jan 2007
Location: Sri Lanka
Posts: 596
Rep Power: 0
AfTriX is an unknown quantity at this point
Default

You are welcome!

Each thanks that is welcomed and recorded is a nest egg by the side of which more will be laid..... Juz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-06-2007, 12:15 PM
oasisjoel oasisjoel is offline
Newbie
 
Join Date: Dec 2007
Posts: 2
Rep Power: 0
oasisjoel is on a distinguished road
Default HElp

I used your... And theres a bug everytime you try to load the form with GIF multiple time's there some kind of ERROR
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 12-06-2007, 12:17 PM
oasisjoel oasisjoel is offline
Newbie
 
Join Date: Dec 2007
Posts: 2
Rep Power: 0
oasisjoel is on a distinguished road
Default

BTW your program has a bug RUN-Time Error -1
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-02-2008, 02:08 PM
juriani_rahul juriani_rahul is offline
Newbie
 
Join Date: Mar 2008
Posts: 1
Rep Power: 0
juriani_rahul is on a distinguished road
Default

awesum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 03-07-2008, 05:31 AM
simon8088 simon8088 is offline
Newbie
 
Join Date: Mar 2008
Posts: 1
Rep Power: 0
simon8088 is on a distinguished road
Default

great tutorial!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 03-09-2008, 04:35 PM
MasterPerkins MasterPerkins is offline
Newbie
 
Join Date: Mar 2008
Posts: 1
Rep Power: 0
MasterPerkins is on a distinguished road
Default Re: VB 6.0: Tutorial, How to make a GIF in your application

most def will try this out!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 03-18-2008, 03:58 AM
witcherofhell witcherofhell is offline
Newbie
 
Join Date: Mar 2008
Posts: 1
Rep Power: 0
witcherofhell is on a distinguished road
Default Re: VB 6.0: Tutorial, How to make a GIF in your application

great work man keep it up
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
VB 6.0: Tutorial, Using the MsgBox TcM VB Tutorials 5 08-31-2008 01:14 PM
VB 6.0: Tutorial, Making a Port Scanner TcM VB Tutorials 80 08-30-2008 04:59 PM
VB 6.0: Tutorial, How to Make Glass2K!! TcM VB Tutorials 11 06-02-2008 02:08 PM
VB 6.0: Tutorial, Explaining the VB 6.0 GUI TcM VB Tutorials 1 05-18-2007 10:25 AM
John's Java Tutorial Index John Java Tutorials 0 01-11-2007 03:05 PM


All times are GMT -5. The time now is 03:32 AM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
LogicKills ........ 20.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 67%

Ads