Seamless moving backgrounds

make a moving background with one picture and multiple picture boxes

Page 1 of 1

1 Replies - 2167 Views - Last Post: 18 July 2010 - 05:18 AM Rate Topic: -----

#1 Wezza  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 16-July 10

Seamless moving backgrounds

Posted 17 July 2010 - 06:35 AM

i need some help with making a seamless moving background where a single image repeats itself again and again going from right to left in a loop, the code i did below is not very seemless and has some lagging issues any help is great.
   
 Private Sub tmrBackground_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrBackground.Tick
        pbBack1.Left -= BackSpeed
        pbBack2.Left -= BackSpeed
        pbBack3.Left -= BackSpeed
        If pbBack1.Left <= Me.Left - pbBack1.Width - 70 Then
            pbBack1.Left = Me.Left + pbBack1.Width - 90
        End If
        If pbBack2.Left <= Me.Left - pbBack2.Width - 70 Then
            pbBack2.Left = Me.Left + pbBack2.Width - 90
        End If
        If pbBack3.Left <= Me.Left - pbBack3.Width - 70 Then
            pbBack3.Left = Me.Left + pbBack3.Width - 90
        End If
    End Sub


thanks guys

Is This A Good Question/Topic? 0
  • +

Replies To: Seamless moving backgrounds

#2 sungchoiok  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 44
  • View blog
  • Posts: 140
  • Joined: 18-July 10

Re: Seamless moving backgrounds

Posted 18 July 2010 - 05:18 AM

You are using pictureboxes, right?

I personally believe using pictureboxes, it's virtually impossible to generate smooth images..

What I did was make one Bitmap (during runtime.)
And then draw to the Bitmap instead of the monitor.
When you are finished drawing to the Bitmap, draw the Bitmap into the monitor all at once.

This method completely removes every flickering, but it is quite elaborate if you are not acquainted with VB.NET yet.

Well, this is the algorithm.

If you need coding, you can reply to this, mail to me, or ask anyone else.
I don't have time right now.. gotta go!

This post has been edited by sungchoiok: 18 July 2010 - 05:24 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1