Flickering gifs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vdraceil
    New Member
    • Jul 2007
    • 236

    Flickering gifs

    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?
  • gobblegob
    New Member
    • Dec 2007
    • 133

    #2
    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.
    Last edited by debasisdas; Apr 10 '08, 12:02 PM. Reason: added code=vb tags

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      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

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        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

        Comment

        • daniel aristidou
          Contributor
          • Aug 2007
          • 494

          #5
          In new versions of vb enable the double buffering property of the form. then use doublebuffering syntax

          Comment

          Working...