Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

moving gifs on a form 2

Status
Not open for further replies.

f1car

Technical User
Apr 2, 2001
69
US
How do you add a moving gig to a form? I can create it with image or picture control, but it doesn't move, help!
 
Hi,
You are locking controls on the form, click at menu bar Format\Lock Controls again to unlock them.

Jimmy Le
nhan_tiags@yahoo.com
 
Thanks Jimmy,

But it still didn't work, maybe I should of mention that I'm using VB5?
 
None of the standard VB controls support animated gifs, which is what I think you are enquiring about.

Which isn't a very helpful reply, I know. If I get time I'll try and figure out a solution and post it here.
 
strongm, yes you are correct in what I'm trying to do.

I didn't know that VB didn't support a moving gif on a standard form.

Thank you for your help thou.
 
Does it have to be an animated gif?

You could use the Multimedia control to display a .AVI file.

Chaz
 
The Web Browser control displays animated gifs quite nicely. Size the control on a form and...
[tt]
WebBrowser1.Navigate App.Path & "\MyAnimated.gif"
[/tt]
How simple can you get?
VCA.gif

Alt255@Vorpalcom.Intranets.com​
 
That was the method I was thinking of using but in the end it is no good, in my opinion. The WebBrowser control always appears with a border, and always puts in a vertical scroll bar (at least it does here, even though the documentation claims otherwise). Which is a pain.

We just need an alternative to the WebBrowser control that doesn't suffer from these drawbacks...and the DHTML Edit Control for IE5 is ideal.

Add the above to your project as a component. Drop a DHTMLSafe control onto your form, and add a command button. Then copy and paste the following code:

Option Explicit

Private Sub Command1_Click()
LoadDHTMLImage &quot;<full_path_to_your_gif_file>&quot;
End Sub



Public Function LoadDHTMLImage(strFile As String) As Boolean
Dim myHTML As String
Dim picDummy As StdPicture
Dim strImageLoad As String

Set picDummy = LoadPicture(strFile)

DHTMLSafe1.Width = ScaleX(picDummy.Width, 6, 1) / 100 ' scale from STDPicture's HiMetric to Twips
DHTMLSafe1.Height = ScaleY(picDummy.Height, 6, 1) / 100 ' scale from STDPicture's HiMetric to Twips

' Note: we are forming REALLY bad HTML here, but it does the job...
strImageLoad = &quot;<img src='file:///&quot; + strFile + &quot;'>&quot;
myHTML = &quot;<body topmargin='0' leftmargin='0'>&quot;
myHTML = myHTML + strImageLoad

myHTML = myHTML + &quot;</body>&quot;

DHTMLSafe1.NewDocument
DHTMLSafe1.DocumentHTML = myHTML
End Function


 
The Web Browser scroll bar and border really aren't a problem if you don't mind adding an extra control.

Place a borderless, captionless frame on the form, size it until it is only as large as the GIF. Resize the Web Browser control until it is about 25% larger than the GIF. Cut the Web Browser and paste it on the frame. Drag it up and to the left a bit and run the project.

The borders and scroll bars will disappear.

Not nearly as functional as Strongm's solution but it might be a bit easier to use.
VCA.gif

Alt255@Vorpalcom.Intranets.com​
 
Alt255,

Interestingly, it looks you and I were thinking alike - as the extra control option was one I also considered.

Mike
 
Wow thanks for all the help guys/gals; this forum is really on top of things.

I only hope that one day I can some how pay you guys back.

BR//Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top