Blot et par kommentarer: Graphics objektet bør nok disposes. Jeg vil _tro_ at man bør Invoke kaldet til Invalidate, da det kører på en anden tråd end hovedtråden.
Private picture As Bitmap = New Bitmap("C:\\Source.Net20\\e792831\\e792831.JPG")
Private pictureScroller As System.Windows.Forms.Timer = New System.Windows.Forms.Timer() Private pictureOffset As Integer = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.PictureBox1.Image = New Bitmap(Me.PictureBox1.Width, Me.PictureBox1.Height)
pictureScroller.Interval = 100 AddHandler pictureScroller.Tick, AddressOf pictureScroller_Tick pictureScroller.Start() End Sub
Sub pictureScroller_Tick(ByVal sender As Object, ByVal e As EventArgs) pictureOffset += 1 pictureOffset = pictureOffset Mod picture.Width
Dim g As Graphics = Graphics.FromImage(Me.PictureBox1.Image) g.DrawImage(picture, pictureOffset, 0) g.DrawImage(picture, pictureOffset - picture.Width, 0)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = 0
pictureScroller.Start()
End Sub
End Class ---
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.