'摩天輪支架
'摩天輪連接纜繩
'摩天輪轉動動作
Public Class Form1
Dim x2, y2 As Single
Dim angle
Dim anglePi
Dim r
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Me.Width = 600
Me.Height = 600
Me.BackColor = Color.White
'摩天輪支架
e.Graphics.DrawLine(Pens.Black, 300, 250, 300 + 100, 550)
e.Graphics.DrawLine(Pens.Black, 300, 250, 300 - 100, 550)
e.Graphics.DrawLine(Pens.Black, 300 - 83, 500, 300 + 83, 500)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim g As Graphics = Me.CreateGraphics
g.DrawLine(Pens.White, 300, 250, x2, y2)
anglePi = angle * 3.14159 / 180
x2 = 300 + r * Math.Cos(anglePi)
y2 = 250 + r * Math.Sin(anglePi)
'摩天輪連接纜繩
g.DrawLine(Pens.Black, 300, 250, x2, y2)
angle = angle + 15
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer1.Interval = 100
r = 200
angle = 0
End Sub
End Class
沒有留言:
張貼留言