I use a timer for loading a series of gif images.when doing so,when each gif is loaded a flick occurs..i have to use gif images for their transparent background properties.what should i do to prevent these flickerings?
Flickering gifs
Collapse
X
-
hi vdradeil,
Use a WebBrowser Control instead of a timer
[CODE=vb]Private Sub Form_Load()
'Resize the WebBrowser control to the size of the picture
With WebBrowser1
.Width = Image1.Width + 45
.Height = Image1.Height + 45
End With
'Call the function to display the image in the WebBrowser control
Call ShowAnimatedGIF (WebBrowser1, Image1, App.Path & "\image.gif ")
End Sub
Public Sub ShowAnimatedGIF (WB As Control, _
img As Control, ByVal sFileGIF As String)
Dim sHTML As String
'define size
img.Picture = LoadPicture(sFi leGIF)
With WB
'size of WebBrowser control
.Width = img.Width + 45
.Height = img.Height + 45
'HTML code to show the graphic
sHTML = "about:" & _
"<html>" & _
"<body leftMargin=0 topMargin=0 marginheight=0 marginwidth=0 scroll=no>" & _
"<img src=""" & sFileGIF & """></img></body></html>"
.Silent = True
.Navigate sHTML
End With
End Sub[/CODE]
GobbleGob. -
Another possibility is to use the "double buffering" technique. That is, don't load the image directly to the display. Load it into a hidden picturebox (or whatever), then once Windows has had a chance to finish rendering the image, move it to the front or make it visible. You'd probably have two pictureboxes, and switch back and forth each time you load another image.Comment
-
In new versions of vb enable the double buffering property of the form. then use doublebuffering syntaxComment
Comment