Easy way to animate GIF on a form.

Easy way to animate GIF on a form.

am 11.11.2007 13:37:21 von dean

I am working on a project for a client. I had the need to animate a
couple of GIFs write on the form. I hadn't done anything like that in
a long time if at all. I read through several posts here and on
www.planetsourcecode.com.

I came across this code:
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtC odeId=29928&lngWId=1&txtForceRefresh=111120077195643934

And he's right: Without this you get the annoying scrollbar
regardless of the size of your image.


Firs thing I have is a CurPath function the I use frequently through
out my app. This function gets me the current patch of the database
no matter where it is used by the client. I know there's other code
that does this.

Function CurPath() As String
CurPath = Left$(CurrentDb.Name, InStr(1, CurrentDb.Name,
"BatchPosting.mdb") - 1)
End Function

On a form I want animation on, I used a web browser object. Named it
WebBrw. Some folks hate to use the browser function but most PC's
have IE on them.

On open code reads:
Dim brs As Object
Set brs = Me.WebBrw
brs.Navigate "about: TOPMARGIN='0' LEFTMARIGIN='0' MARGINWIDTH='0' MARGINHEIGHT='0'> src='" & CurPath & "j0297033.gif'"


There are probably parts of this HTML document that could be removed.
I had not tested that theory yet. This works extremely fast on a
Pentium 700 even. Hope this helps others.