by ReXz (9 Submissions)
Category: Graphics
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating:
(3 Votes)

This code draws something wierd...but cool! Lines rules! =)
Inputs
two timers called 'timer1' and 'timer2' and interval : 1, scalemode : pixel, Backcolor : black
API DeclarationsDim Color As Integer, lx2 As Integer, lx1 As Integer
Private Sub Form_Load()
lx2 = Me.ScaleWidth
Color = 0
End Sub
Private Sub Timer1_Timer()
Color = Color + 1
If Color < 255 Then
Me.ForeColor = RGB(Color, 0, 0)
lx1 = lx1 + 3
lx2 = lx2 - 3
Me.Line (lx1, Me.ScaleLeft)-(lx1, Me.ScaleWidth)
Me.Line (lx2, Me.ScaleWidth)-(lx2, Me.ScaleLeft)
Me.Line (0, lx1)-(Me.ScaleWidth, lx1)
Me.Line (Me.ScaleHeight, lx1)-(Me.ScaleTop, lx2)
ElseIf Color > 254 Then
Timer1.Enabled = False
Timer2.Enabled = True
End If
End Sub
Private Sub Timer2_Timer()
Color = Color - 1
If Color > 1 Then
Me.ForeColor = RGB(Color, 0, 0)
lx1 = lx1 + 3
lx2 = lx2 - 3
Me.Line (lx1, Me.ScaleLeft)-(lx1, Me.ScaleWidth)
Me.Line (lx2, Me.ScaleWidth)-(lx2, Me.ScaleLeft)
Me.Line (0, lx1)-(Me.ScaleWidth, lx1)
Me.Line (Me.ScaleHeight, lx1)-(Me.ScaleTop, lx2)
ElseIf Color < 1 Then
Timer2.Enabled = False
End If
End Sub