home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form BlackBoard
- AutoRedraw = -1 'True
- BackColor = &H00000000&
- BorderStyle = 0 'None
- Caption = "Black Board!"
- ClientHeight = 1935
- ClientLeft = 4875
- ClientTop = 6345
- ClientWidth = 3615
- Icon = "BlackBoard.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1935
- ScaleWidth = 3615
- WindowState = 2 'Maximized
- Begin VB.Timer Timer1
- Enabled = 0 'False
- Interval = 3
- Left = 120
- Top = 120
- End
- Attribute VB_Name = "BlackBoard"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Sub Calc(Op As Integer)
- '********************************************************
- 'This is where all happens
- '********************************************************
- 'Declare local static variabled required for the program
- Static X(7) As Integer, Y(7) As Integer
- Static T1(7) As Integer, T2(7) As Integer
- Static Maxx As Long, Maxy As Long
- Static C(3) As Integer, CP(3) As Integer
- 'Get the Forms Size and take 5 twips
- Maxx = Me.Width - 5
- Maxy = Me.Height - 5
- '1st time. Set the variables values
- If Op = 1 Then
- 'Start the random number generator
- Randomize
- 'Update the "coordinate points" variables
- T1(0) = Int(Rnd * Maxx)
- T1(1) = Int(Rnd * Maxy)
- T1(2) = Int(Rnd * Maxx)
- T1(3) = Int(Rnd * Maxy)
- T1(4) = Int(Rnd * Maxx)
- T1(5) = Int(Rnd * Maxy)
- T1(6) = Int(Rnd * Maxx)
- T1(7) = Int(Rnd * Maxy)
- 'Update the "delocation factor" variables
- X(0) = 60
- Y(0) = 80
- X(1) = 80
- Y(1) = 100
- X(2) = 100
- Y(2) = 60
- X(3) = 90
- Y(3) = 90
- 'Update the "gradient color" variables
- C(1) = Int(Rnd * 256)
- C(2) = Int(Rnd * 256)
- C(3) = Int(Rnd * 256)
- 'Update the "gradient factor" variables
- CP(1) = 2
- CP(2) = 3
- CP(3) = 4
- 'Do the next code
- Op = 2
- End If
- If Op = 2 Then
- 'Update the "points coordinates" variables
- T2(0) = T1(0)
- T2(1) = T1(1)
- T2(2) = T1(2)
- T2(3) = T1(3)
- T2(4) = T1(4)
- T2(5) = T1(5)
- T2(6) = T1(6)
- T2(7) = T1(7)
- X(4) = X(0)
- Y(4) = Y(0)
- X(5) = X(1)
- Y(5) = Y(1)
- X(6) = X(2)
- Y(6) = Y(2)
- X(7) = X(3)
- Y(7) = Y(3)
- 'Set the "left trails" variable to 0
- A = 0
- 'Clear the screen
- Me.Cls
- End If
- 'Check if the "gradient factor" variables are between 0
- 'and 255 and update the "gradient color" variables
- For I = 1 To 3
- If C(I) + CP(I) < 0 Or C(I) + CP(I) > 255 Then CP(I) = -CP(I)
- C(I) = C(I) + CP(I)
- Next I
- 'Draw the Polygon
- Dpoly T1, RGB(C(1), C(2), C(3))
- 'Check if the points have colided with the border of the
- 'screen. If so update the "delocation factor" variables
- If T1(0) < 1 Or T1(0) > Maxx Then X(0) = -X(0)
- If T1(2) < 1 Or T1(2) > Maxx Then X(1) = -X(1)
- If T1(4) < 1 Or T1(4) > Maxx Then X(2) = -X(2)
- If T1(6) < 1 Or T1(6) > Maxx Then X(3) = -X(3)
- If T1(1) < 1 Or T1(1) > Maxy Then Y(0) = -Y(0)
- If T1(3) < 1 Or T1(3) > Maxy Then Y(1) = -Y(1)
- If T1(5) < 1 Or T1(5) > Maxy Then Y(2) = -Y(2)
- If T1(7) < 1 Or T1(7) > Maxy Then Y(3) = -Y(3)
- 'Check if the "delete trails" variable is true
- If DelLines = True Then
- 'If so, check if the "lefted trails" variable is bigger
- 'than the "trails size" variable
- If A > RST Then
- 'If so, delete the old trails, by drawing a black polygon
- 'over them
- Dpoly T2, 0
- 'Update the 2nd poly "coordinate points" variables as
- 'with the 1st
- If T2(0) < 1 Or T2(0) > Maxx Then X(4) = -X(4)
- If T2(2) < 1 Or T2(2) > Maxx Then X(5) = -X(5)
- If T2(4) < 1 Or T2(4) > Maxx Then X(6) = -X(6)
- If T2(6) < 1 Or T2(6) > Maxx Then X(7) = -X(7)
- If T2(1) < 1 Or T2(1) > Maxy Then Y(4) = -Y(4)
- If T2(3) < 1 Or T2(3) > Maxy Then Y(5) = -Y(5)
- If T2(5) < 1 Or T2(5) > Maxy Then Y(6) = -Y(6)
- If T2(7) < 1 Or T2(7) > Maxy Then Y(7) = -Y(7)
- T2(0) = T2(0) + X(4)
- T2(1) = T2(1) + Y(4)
- T2(2) = T2(2) + X(5)
- T2(3) = T2(3) + Y(5)
- T2(4) = T2(4) + X(6)
- T2(5) = T2(5) + Y(6)
- T2(6) = T2(6) + X(7)
- T2(7) = T2(7) + Y(7)
- Else
- 'Update the "left trails" variable
- A = A + 1
- End If
- End If
- 'Update the 1st polygon "coordinate points" variables
- T1(0) = T1(0) + X(0)
- T1(1) = T1(1) + Y(0)
- T1(2) = T1(2) + X(1)
- T1(3) = T1(3) + Y(1)
- T1(4) = T1(4) + X(2)
- T1(5) = T1(5) + Y(2)
- T1(6) = T1(6) + X(3)
- T1(7) = T1(7) + Y(3)
- 'Do the cached events
- DoEvents
- End Sub
- Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- Static T As Double, S As String
- 'Protect against accidental Mouse Moving
- If T = 0 Then
- T = Timer + 0.2
- ElseIf Timer > T And SS = True Then
- 'Stop drawing
- Timer1.Enabled = False
- 'Check if the "require password" variable is true and
- 'there is a valid password
- If P = True And PSWD <> "" Then
- 'If so, ask for the password
- S = InputBox("Please enter the PassWord:", "Exit!", "")
- 'Check if Cancel was pressed or an incorrect password
- 'was entered
- If S = "" Or S <> PSWD Then
- 'If Cancel wasn't pressed show an Error Message Box
- If S <> "" Then MsgBox "Incorrect PassWord!", vbApplicationModal + vbCritical, "Exit!"
- 'Restart drawing and exit this Sub
- Timer1.Enabled = True
- T = 0
- Exit Sub
- End If
- End If
- 'Unload the program
- Unload Menu
- Unload BlackBoard
- End If
- End Sub
- Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'Check if right button was pressed and not in Screen
- 'Saver Mode
- If Button = 2 And SS = False Then
- 'Stop drawing and the the submenu
- Timer1.Enabled = False
- Me.PopupMenu Menu.mnuFile, , X, Y
- Else
- 'Else, continue drawing the mistify polygons
- Timer1.Enabled = True
- End If
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- 'Show the cursor
- ShowCursor 1
- End Sub
- Private Sub Timer1_Timer()
- 'Draw the mistify polygons
- Calc (0)
- End Sub
- Sub Dpoly(P() As Integer, C As Long)
- Dim I As Integer
- 'Draw the lines that delimit the polygon
- For I = 0 To (Pts - 2) * 2 Step 2
- Line (P(I), P(I + 1))-(P(I + 2), P(I + 3)), C
- Next I
- Line (P(I), P(I + 1))-(P(0), P(1)), C
- End Sub
-