Public Class Form1
Dim anm As Integer = 1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
R1.Left = R1.Left 5
animate()
If R1.Left >= 210 Then
Dim w = R1.Width
R1.Width = R1.Height
R1.Height = w
Timer1.Stop()
Timer2.Start()
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
R1.Top = R1.Top 5
animate()
R1.Image.RotateFlip(RotateFlipType.Rotate90FlipNone)
R1.Refresh()
If R1.Top >= 190 Then
Dim w = R1.Width
R1.Width = R1.Height
R1.Height = w
Timer2.Stop()
Timer3.Start()
End If
End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
R1.Left = R1.Left - 5
animate()
R1.Image.RotateFlip(RotateFlipType.Rotate180FlipNone)
R1.Refresh()
If R1.Top <= 0 Then
Dim w = R1.Width
R1.Width = R1.Height
R1.Height = w
Timer3.Stop()
Timer4.Start()
End If
End Sub
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
R1.Top = R1.Top - 2
animate()
R1.Image.RotateFlip(RotateFlipType.Rotate90FlipNone)
R1.Refresh()
If R1.Top <= 0 Then
Dim w = R1.Width
R1.Width = R1.Height
R1.Height = w
Timer4.Stop()
Timer1.Start()
End If
End Sub
Private Sub animate()
If anm = 1 Then
R1.Image = Image.FromFile(Application.StartupPath & "\1_SONICRUN1-removebg-preview-removebg-preview.png")
anm = 2
ElseIf anm = 2 Then
R1.Image = Image.FromFile(Application.StartupPath & "\1_SONICRUN2-removebg-preview-removebg-preview.png")
anm = 3
ElseIf anm = 3 Then
R1.Image = Image.FromFile(Application.StartupPath & "\1_SONICRUN3-removebg-preview-removebg-preview.png")
anm = 4
ElseIf anm = 4 Then
R1.Image = Image.FromFile(Application.StartupPath & "\1_SONICRUN4-removebg-preview-removebg-preview.png")
anm = 1
End If
End Sub
End Class
請幫助我希望它像

每次碰到拐角時它都需要切換位置,就像它一開始是倒置的,當它碰到拐角時它是朝下的。確保它沒問題請你幫忙我真的需要幫助。多謝你們。我需要它在圖片框回圈移動時制作影片。
uj5u.com熱心網友回復:
您可以嘗試交換圖片框的高度和寬度,然后旋轉里面的影像,以達到您想要的效果。
Dim anm As Integer = 1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
R1.Left = R1.Left 2
animate()
If R1.Left >= 219 Then
Dim w = R1.Width
R1.Width = R1.Height
R1.Height = w
Timer1.Stop()
Timer2.Start()
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
R1.Top = R1.Top 2
animate()
R1.Image.RotateFlip(RotateFlipType.Rotate90FlipNone)
R1.Refresh()
If R1.Top >= 202 Then
Dim w = R1.Width
R1.Width = R1.Height
R1.Height = w
Timer2.Stop()
Timer3.Start()
End If
End Sub
Private Sub animate()
If anm = 1 Then
R1.Image = Image.FromFile("picture1")
anm = 2
ElseIf anm = 2 Then
R1.Image = Image.FromFile("picture2")
anm = 3
ElseIf anm = 3 Then
R1.Image = Image.FromFile("picture3")
anm = 4
ElseIf anm = 4 Then
R1.Image = Image.FromFile("picture4")
anm = 1
End If
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/474299.html
下一篇:vb.net影片刺猬索尼克
