+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: VB 6.0: Tutorial, How to make a GIF in your application

  1. #1
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    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 Attached Files
    Last edited by Jordan; 10-02-2006 at 09:44 AM. Reason: Picture Location Change

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    AfTriX is offline Programming God
    Join Date
    Jan 2007
    Location
    Chicago
    Posts
    586
    Rep Power
    0
    Nice work buddy

  4. #3
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    Quote Originally Posted by AfTriX View Post
    Nice work buddy
    Thanks Just a trick of the trade!

  5. #4
    AfTriX is offline Programming God
    Join Date
    Jan 2007
    Location
    Chicago
    Posts
    586
    Rep Power
    0
    You are welcome!

    Each thanks that is welcomed and recorded is a nest egg by the side of which more will be laid..... Juz

  6. #5
    oasisjoel is offline Newbie
    Join Date
    Dec 2007
    Posts
    2
    Rep Power
    0

    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

  7. #6
    oasisjoel is offline Newbie
    Join Date
    Dec 2007
    Posts
    2
    Rep Power
    0
    BTW your program has a bug RUN-Time Error -1

  8. #7
    juriani_rahul is offline Newbie
    Join Date
    Mar 2008
    Posts
    1
    Rep Power
    0
    awesum

  9. #8
    simon8088 is offline Newbie
    Join Date
    Mar 2008
    Posts
    1
    Rep Power
    0
    great tutorial!

  10. #9
    MasterPerkins is offline Newbie
    Join Date
    Mar 2008
    Posts
    1
    Rep Power
    0

    Re: VB 6.0: Tutorial, How to make a GIF in your application

    most def will try this out!

  11. #10
    witcherofhell is offline Newbie
    Join Date
    Mar 2008
    Posts
    1
    Rep Power
    0

    Re: VB 6.0: Tutorial, How to make a GIF in your application

    great work man keep it up

+ Reply to Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to make a DOS console application using PHP?
    By Melinanushka in forum PHP Development
    Replies: 4
    Last Post: 10-14-2011, 05:53 PM
  2. how to make setup of a windows application?
    By mraduliitm in forum C# Programming
    Replies: 4
    Last Post: 10-08-2010, 01:21 AM
  3. Replies: 8
    Last Post: 08-10-2010, 10:45 PM
  4. Make application translatable
    By Shaddix in forum Java Help
    Replies: 5
    Last Post: 09-29-2009, 05:13 AM
  5. Make application skinnable
    By Frantic in forum C# Programming
    Replies: 2
    Last Post: 09-28-2006, 05:27 AM

Tags for this Thread

Bookmarks

Posting Permissions

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