
Untitled
By:
austintav on
Aug 3rd, 2012 | syntax:
None | size: 1.40 KB | hits: 16 | expires: Never
Public Class Form1
Dim PenUse As Integer
Dim Point1(1) As Integer
Dim Point2(2) As Integer
Dim formSurface As Graphics = Me.CreateGraphics
Dim pen1 As New Pen(Color.Red, 10)
Dim Pen2 As New Pen(Color.Blue, 20)
Dim Pen3 As New Pen(Color.Green, 40)
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Randomize()
PenUse = Int((3 - 1 + 1) * Rnd() + 3)
Point1(0) = Int((180 - 20 + 1) * Rnd() + 20)
Point1(1) = Int((180 - 20 + 1) * Rnd() + 20)
Point2(0) = Int((180 - 20 + 1) * Rnd() + 20)
Point2(1) = Int((180 - 20 + 1) * Rnd() + 20)
Select PenUse
Case 1
formSurface.DrawLine(pen1, Point1(0), Point1(1), Point2(0), Point2(1))
Case 2
formSurface.DrawLine(Pen2, Point1(0), Point1(1), Point2(0), Point2(1))
Case 3
formSurface.DrawLine(Pen3, Point1(0), Point1(1), Point2(0), Point2(1))
End Select
End Sub
Private Sub btnFaster_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFaster.Click
Me.Timer1.Interval = Me.Timer1.Interval - 10
End Sub
Private Sub btnSlower_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSlower.Click
Me.Timer1.Interval = Me.Timer1.Interval + 10
End Sub
End Class