I would like to embed an animation gif in a picture box or image box in VB6, but the gif picture just a static picture in the run time and design time.
Thus is it possible to embed an animation gif in a VB program?Thx a lot!
Sadly neither the VB Picturebox or Image control support animated gifs. However, browsers do! So consider dropping a Webbrowser DHTML Edit control onto your form. I happen to prefer the DHTML Edit control, so here is an example: pop a DHTML Edit control onto a form (you'll need to have added it a a component, set its Appearance property to 0 (flat), and Scrollbars property to False (this is one of the reasons why I prefer the DHTML control to the Webbrowser; it is easier to get rid of scrollbars...), then add this function to your project: [tt]
Private Function DHTMLLoadPicture(strPicFile As String, Optional StretchToFit As Boolean = False) As Picture
Dim tmpPic As Picture
Dim OldScale As Long
Set tmpPic = LoadPicture(strPicFile)
OldScale = Form1.ScaleMode
If StretchToFit Then
Form1.ScaleMode = vbMillimeters
DHTMLEdit1.Width = tmpPic.Width / 100 ' Picture width and height are returned in HiMetric units
DHTMLEdit1.Height = tmpPic.Height / 100 ' so convert to millimeters
' Webbrowser control version
' WebBrowser1.Width = tmpPic.Width / 100
' WebBrowser1.Height = tmpPic.Height / 100
End If
DHTMLEdit1.DocumentHTML = "<body topmargin='0' leftmargin='0'><p><img border='0' src='" + strPicFile + "'></p></body>"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.