Torna al Thread
Dim p As Image = Nothing
Dim g As Graphics
Dim mu As Integer = 1
Dim ip As Image = Image.FromFile("C:\Windows\System32\migwiz\PostMigRes\Web\base_images\column.bmp").GetThumbnailImage(64, 32, Nothing, Nothing)
Dim ip2 As Image = Image.FromFile("C:\Windows\System32\migwiz\PostMigRes\Web\base_images\column.bmp").GetThumbnailImage(64, 32, Nothing, Nothing)
If IsNothing(p) Then
p = New Bitmap(PictureBox1.Width, PictureBox1.Height, Imaging.PixelFormat.Format32bppArgb)
PictureBox1.Image = p
End If
g = Graphics.FromImage(p)
Dim initx As Integer = 0
Dim fromLastframe As Double = 0
Dim lastframe As Long = -1
Dim curframe As Long = -1
While True
If curframe = -1 And lastframe = -1 Then
fromLastframe = curframe - lastframe
Else
curframe = Format(Date.Now, "ssfff")
fromLastframe = (curframe - lastframe) / 100 'microsec
g.Clear(Color.White)
g.DrawImage(ip, New Point(initx, 30))
initx = initx + (10 * fromLastframe) * mu
If initx > 400 Then
mu = -1
ElseIf initx < -10 Then
mu = 1
End If
g.DrawImage(ip2, New Point(60, initx))
'g.Flush()
PictureBox1.Invalidate()
End If
lastframe = Format(Date.Now, "ssfff")
Threading.Thread.Sleep(32)
End While