By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,996 Members | 896 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,996 IT Pros & Developers. It's quick & easy.

Flickering gifs

vdraceil
100+
P: 236
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?
Apr 8 '08 #1
Share this Question
Share on Google+
4 Replies


100+
P: 133
hi vdradeil,
Use a WebBrowser Control instead of a timer

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. 'Resize the WebBrowser control to the size of the picture
  3. With WebBrowser1
  4.   .Width = Image1.Width + 45
  5.   .Height = Image1.Height + 45
  6. End With
  7. 'Call the function to display the image in the WebBrowser control
  8. Call ShowAnimatedGIF(WebBrowser1, Image1, App.Path & "\image.gif")
  9. End Sub
  10.  
  11. Public Sub ShowAnimatedGIF(WB As Control, _
  12.   img As Control, ByVal sFileGIF As String)
  13.   Dim sHTML As String
  14.   'define size
  15.   img.Picture = LoadPicture(sFileGIF)
  16.   With WB
  17.     'size of WebBrowser control
  18.     .Width = img.Width + 45
  19.     .Height = img.Height + 45
  20.     'HTML code to show the graphic
  21.     sHTML = "about:" & _
  22.       "<html>" & _
  23.       "<body leftMargin=0 topMargin=0 marginheight=0 marginwidth=0 scroll=no>" & _
  24.       "<img src=""" & sFileGIF & """></img></body></html>"
  25.     .Silent = True
  26.     .Navigate sHTML
  27.   End With
  28. End Sub
GobbleGob.
Apr 10 '08 #2

Expert 5K+
P: 8,434
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.
Apr 11 '08 #3

QVeen72
Expert 100+
P: 1,445
Hi,

if your Gif's are smaller, you can load them in an Image Control..
and later on depending on the Index, you can load them to the pict/image control...
can you post the code in Timer1_Timer event..

Regards
Veena
Apr 11 '08 #4

daniel aristidou
100+
P: 491
In new versions of vb enable the double buffering property of the form. then use doublebuffering syntax
Apr 12 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.