Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.BackColor = Color.Aquamarine
End Sub
Private Sub btnFaster_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFaster.Click
tmrTimer.Interval = tmrTimer.Interval - 10
End Sub
Private Sub btnSlower_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSlower.Click
tmrTimer.Interval = tmrTimer.Interval + 10
End Sub
Private Sub tmrTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrTimer.Tick
'Dim inicolor As New Random()
'Dim intR, intG, intB As Integer
'intR = inicolor.Next(0, 256) 'generates random rgb number
'intG = inicolor.Next(0, 256)
'intB = inicolor.Next(0, 256)
'Dim hexR, hexG, hexB As String
'hexR = intR.ToString("X").PadLeft(2, "0"c) 'converts it to hex
'hexG = intG.ToString("X").PadLeft(2, "0"c)
'hexB = intB.ToString("X").PadLeft(2, "0"c)
'Dim strColor As String
'strColor = "#" & hexR & hexG & hexB
'Dim var = Drawing.Color.FromArgb(intR, intG, intB)
'Me.BackColor = var
Dim formSurface As Graphics = Me.CreateGraphics 'creates surface
Dim line As Integer = (Int((5 - 1 + 1) * Rnd() + 1))
Dim pen As New Pen(Color.Green, line)
Dim p1horizontal As Integer = (Int((300 - 0 + 1) * Rnd() + 0)) 'generates 4 random line coordinates
Dim p1vertical As Integer = (Int((300 - 0 + 1) * Rnd() + 0))
Dim p2horizontal As Integer = (Int((300 - 0 + 1) * Rnd() + 0))
Dim p2vertical As Integer = (Int((300 - 0 + 1) * Rnd() + 0))
formSurface.DrawLine(pen, p1horizontal, p1vertical, p2horizontal, p2vertical)
Media.SystemSounds.Beep.Play()
formSurface.DrawLine(pen, p1horizontal, p1vertical, p2horizontal, p2vertical)
End Sub
End Class