Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > load an animated gif?


Reply
 
Thread Tools Display Modes
  #1  
Old 09-02-2005, 12:44 PM
spider661 spider661 is offline
Newcomer
 
Join Date: Aug 2005
Posts: 15
Default load an animated gif?


i want to load a animated gif in App.Path & "\pics\ants_2.gif" on keypress A but i cant figer out 2 things..

one how to get keypress on formload im guessing and how to make it animated its already an animated pic but when i put it into a pic box manually and load the form its not moveing is there somethign you got to do to make it load animated gifs..

can someone please help me with this code.

thanks
Reply With Quote
  #2  
Old 09-02-2005, 01:01 PM
drutger's Avatar
drutger drutger is offline
Centurion
 
Join Date: Nov 2003
Location: Gothenburg, Sweden
Posts: 175
Default

Quote:
Originally Posted by spider661
i want to load a animated gif in App.Path & "\pics\ants_2.gif" on keypress A but i cant figer out 2 things..

one how to get keypress on formload im guessing and how to make it animated its already an animated pic but when i put it into a pic box manually and load the form its not moveing is there somethign you got to do to make it load animated gifs..

can someone please help me with this code.

thanks
Set the forms keypreview to 'true' and then under the forms keyup event you can write the code if keycode=vbkeya then....
cant help you with the animated gif thing thou
Reply With Quote
  #3  
Old 09-02-2005, 01:12 PM
spider661 spider661 is offline
Newcomer
 
Join Date: Aug 2005
Posts: 15
Default

Quote:
Originally Posted by drutger
Set the forms keypreview to 'true' and then under the forms keyup event you can write the code if keycode=vbkeya then....
cant help you with the animated gif thing thou
Ok i set keypreview to true and useing this code
Code:
Option Explicit Private Sub Form_KeyPress(KeyAscii As Integer) If Chr(KeyAscii) = vbKeyA Then picLoader.Picture = LoadPicture(App.Path & "\pics\ants_2.gif") MsgBox ("key " & Chr(KeyAscii)) End If End Sub

but nothing hapening not even the msg box
Reply With Quote
  #4  
Old 09-02-2005, 01:27 PM
drutger's Avatar
drutger drutger is offline
Centurion
 
Join Date: Nov 2003
Location: Gothenburg, Sweden
Posts: 175
Default

Quote:
Originally Posted by spider661
Ok i set keypreview to true and useing this code
Code:
Option Explicit Private Sub Form_KeyPress(KeyAscii As Integer) If Chr(KeyAscii) = vbKeyA Then picLoader.Picture = LoadPicture(App.Path & "\pics\ants_2.gif") MsgBox ("key " & Chr(KeyAscii)) End If End Sub

but nothing hapening not even the msg box
try it in the keydown event and use the code i said: if keycode=vbkeya then...

And you can load your pic into a webbrowser with the code webbrowser1.navigate (App.Path & "\pics\ants_2.gif") but you'll probably get the bars on the right and bottom side.
Reply With Quote
  #5  
Old 09-02-2005, 01:30 PM
spider661 spider661 is offline
Newcomer
 
Join Date: Aug 2005
Posts: 15
Default

Quote:
Originally Posted by drutger
try it in the keydown event and use the code i said: if keycode=vbkeya then...

And you can load your pic into a webbrowser with the code webbrowser1.navigate (App.Path & "\pics\ants_2.gif") but you'll probably get the bars on the right and bottom side.
that worked great even the pic loaded but its still not animated i got to go to work ill try the browser later thanks
Reply With Quote
  #6  
Old 09-02-2005, 02:29 PM
mrjeffy321 mrjeffy321 is offline
Ultimate Contributor
 
Join Date: Apr 2003
Location: Texas, USA
Posts: 1,623
Default

Animated gifs can be a pain, as my experience show, however, you do have options.

An animated gif can be broken down into individual [non-animated] frame. When the frames are switched back and forth, it appears to move. So what you can do is break the gif up into its component pictures (I have seen web sites that will do it for you and then you just save each picture, and there are probably other ways), then you can load eacj picture into a picture box and then cycle through them changing the current frame's visibility to true and all others to false.

You can also use the Web Browser control. This will take advantage of the web browser's ability to play animated gif images, just navigate to the image location.

Another possibility is to use the animated gif control (I think that is its name), this is a glorified picture box that allows animated gif images to be show animated, however the disadvantage to this is that if you use it free, each time you run the program it will let you know that your using someone else's control in the form of a message box. Or you could pay.

There are probably a couple more options I havent thought about, and each of the ones I presented here have their own advantages and disadvantages, see which, if any, you prefer.
Reply With Quote
  #7  
Old 09-04-2005, 12:40 AM
hDC_0 hDC_0 is offline
Contributor

* Expert *
 
Join Date: Feb 2004
Posts: 522
Default Playing animated gifs

Quote:
Originally Posted by mrjeffy321
Another possibility is to use the animated gif control (I think that is its name), this is a glorified picture box that allows animated gif images to be show animated.
From the last time this animated gif question was asked (which happens at least once every couple months), this thread has some links to free animated gif controls/code:
http://www.xtremevbtalk.com/t234089.html
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->