MODULE CROSSHATCH Dim invertor As Boolean Private Sub cb_Click() 'This subroutine creates colorbars the user has choosen a menu item captioned 'color bars' xwidth = Screen.Width / 16 display.Cls display.Show For j = 0 To 15 If invertor Then display.Line (j * xwidth, 0)-((j + 1) * xwidth, Screen.Height), QBColor(j), BF Else display.Line (j * xwidth, 0)-((j + 1) * xwidth, Screen.Height), RGB(255, 255, 255) - QBColor(j), BF End If Next End Sub Private Sub CH_Click(Index As Integer) 'this subroutine creates a cross hatch (vertical lines intersecting horizontal lines) pattern Select Case Index 'the user has choosen a menu item captioned 'cross hatch' Case 0 xwidth = Screen.Width / 2 yheight = Screen.Height / 2 a = 1 Case 1 xwidth = Screen.Width / 4 yheight = Screen.Height / 4 a = 3 Case 2 xwidth = Screen.Width / 6 yheight = Screen.Height / 6 a = 5 Case 3 xwidth = Screen.Width / 8 yheight = Screen.Height / 8 a = 7 Case 4 xwidth = Screen.Width / 12 yheight = Screen.Height / 12 a = 11 Case 5 xwidth = Screen.Width / 16 yheight = Screen.Height / 16 a = 15 End Select display.Cls display.Show For j = 1 To a ' draw vertical lines If invertor Then display.Line (j * xwidth, 0)-(j * xwidth, Screen.Height) Else display.Line (j * xwidth, 0)-(j * xwidth, Screen.Height) End If Next For j = 1 To a ' draw horizontal lines If invertor Then display.Line (0, j * yheight)-(Screen.Width, j * yheight) Else display.Line (0, j * yheight)-(Screen.Width, j * yheight) End If Next End Sub Private Sub CIRCLE_Click() ' the user has choosen a menu item captioned circle hatch xcenter = Screen.Width / 2# ycenter = Screen.Height / 2# yheight = Screen.Width / 20# x4 = xcenter / 2# y4 = ycenter / 2# display.Cls display.Show For j = 1 To 10 'draw cicles centered on the center of the screen If invertor Then display.Circle (xcenter, ycenter), j * yheight Else display.Circle (xcenter, ycenter), j * yheight End If Next If invertor Then ' draw an ellipse in each quadrant of the screen display.Circle (x4, y4), 5 * yheight - 36, , , , 3# / 4# display.Circle (3 * x4, y4), 5 * yheight - 36, , , , 3# / 4# display.Circle (x4, y4 * 3), 5 * yheight - 36, , , , 3# / 4# display.Circle (3 * x4, 3 * y4), 5 * yheight - 36, , , , 3# / 4# display.Line (yheight, yheight)-(Screen.Width - yheight, 14 * yheight), , B display.Line (xcenter, 0)-(xcenter, Screen.Height), , B display.Line (0, ycenter)-(Screen.Width, ycenter), , B Else display.Circle (x4, y4), 5 * yheight - 36, , , , 3# / 4# display.Circle (3 * x4, y4), 5 * yheight - 36, , , , 3# / 4# display.Circle (x4, y4 * 3), 5 * yheight - 36, , , , 3# / 4# display.Circle (3 * x4, 3 * y4), 5 * yheight - 36, , , , 3# / 4# display.Line (yheight, yheight)-(Screen.Width - yheight, 14 * yheight), , B display.Line (xcenter, 0)-(xcenter, Screen.Height), , B display.Line (0, ycenter)-(Screen.Width, ycenter), , B End If End Sub Private Sub DOTS_Click(Index As Integer) 'the user has choosen a menu item captioned 'dot hatch' which has sub menu captioned 1,3,5,7,11,15 Select Case Index Case 0 xwidth = Screen.Width / 2 yheight = Screen.Height / 2 a = 1 Case 1 xwidth = Screen.Width / 4 yheight = Screen.Height / 4 a = 3 Case 2 xwidth = Screen.Width / 6 yheight = Screen.Height / 6 a = 5 Case 3 xwidth = Screen.Width / 8 yheight = Screen.Height / 8 a = 7 Case 4 xwidth = Screen.Width / 12 yheight = Screen.Height / 12 a = 11 Case 5 xwidth = Screen.Width / 16 yheight = Screen.Height / 16 a = 15 End Select display.Cls display.Show For j = 1 To a ' draw dots in a matrix pattern based on the user's choice of which submenu they have choosen For k = 1 To a If invertor Then display.PSet (j * xwidth, k * yheight), QBColor(15) Else display.PSet (j * xwidth, k * yheight), QBColor(0) End If Next Next End Sub Private Sub EXITOR_Click() 'the user has clicked a menu item captioned 'exit' Unload crosshatch End Sub Private Sub Form_Activate() ' when the program starts move Me to upper center of screen Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 5 End Sub Private Sub Form_Load() 'When program starts initialize some variables such as screen back ground color of display module invertor = False Call IP_Click End Sub Private Sub Form_Unload(Cancel As Integer) ' When program is about to end check to see if the user actually wanted to end the program If MsgBox("quit program", vbYesNo) = vbYes Then credits.Show ' dispaly credits module Unload crosshatch ' unload main module Else Cancel = vbCancel ' The user indicated they did not intend for program to end and cancel unloading the main module End If End Sub Private Sub HLINES_Click(Index As Integer) ' the user has selected a menu item captioned 'horizontal lines' Select Case Index Case 0 ' the user wants to display a single horizontal line xwidth = Screen.Width / 2 yheight = Screen.Height / 2 a = 1 Case 1 xwidth = Screen.Width / 4 yheight = Screen.Height / 4 a = 3 Case 2 xwidth = Screen.Width / 6 yheight = Screen.Height / 6 a = 5 Case 3 xwidth = Screen.Width / 8 yheight = Screen.Height / 8 a = 7 Case 4 xwidth = Screen.Width / 12 yheight = Screen.Height / 12 a = 11 Case 5 ' the user wants to display 15 evenly spaced horizontal lines xwidth = Screen.Width / 16 yheight = Screen.Height / 16 a = 15 End Select display.Cls display.Show For j = 1 To a ' draw however many lines the user has choosen If invertor Then display.Line (0, j * yheight)-(Screen.Width, j * yheight) Else display.Line (0, j * yheight)-(Screen.Width, j * yheight) End If Next End Sub Private Sub IP_Click() ' the user has clicked a menu item captioned 'invert pattern' If invertor Then display.BackColor = QBColor(15) display.ForeColor = RGB(5, 5, 5) display.FillColor = RGB(5, 5, 5) Else display.BackColor = QBColor(0) display.ForeColor = RGB(240, 240, 240) display.FillColor = RGB(240, 240, 240) End If invertor = Not invertor End Sub Private Sub PURITY_Click(Index As Integer) ' the user has clicked a menu item captioned 'purity patterns' lastcolor = display.BackColor lastcolorfore = display.ForeColor lastcolorfill = display.FillColor Select Case Index Case 0 If invertor Then display.BackColor = RGB(200, 0, 0) ' display a solid red background Else display.BackColor = RGB(0, 200, 200) ' display a solid blue-green background End If Case 1 If invertor Then display.BackColor = RGB(0, 200, 0) 'display a solid green background Else display.BackColor = RGB(200, 0, 200) ' display a solid purple background End If Case 2 If invertor Then display.BackColor = RGB(0, 0, 200) ' display a solid blue background Else display.BackColor = RGB(200, 200, 0) ' display a solid yellow background End If Case 3 If invertor Then display.BackColor = RGB(200, 200, 200) ' display a solid silver background Else display.BackColor = RGB(35, 35, 35) ' display a solid dark gray background End If End Select display.Cls display.Show 1 display.BackColor = lastcolor display.ForeColor = lastcolorfore display.FillColor = lastcolorfill End Sub Private Sub vlines_Click(Index As Integer) ' user has clicked a menu item captioned 'vertical lines' Select Case Index Case 0 xwidth = Screen.Width / 2 yheight = Screen.Height / 2 a = 1 Case 1 xwidth = Screen.Width / 4 yheight = Screen.Height / 4 a = 3 Case 2 xwidth = Screen.Width / 6 yheight = Screen.Height / 6 a = 5 Case 3 xwidth = Screen.Width / 8 yheight = Screen.Height / 8 a = 7 Case 4 xwidth = Screen.Width / 12 yheight = Screen.Height / 12 a = 11 Case 5 xwidth = Screen.Width / 16 yheight = Screen.Height / 16 a = 15 End Select display.Cls display.Show For j = 1 To a If invertor Then display.Line (j * xwidth, 0)-(j * xwidth, Screen.Height) Else display.Line (j * xwidth, 0)-(j * xwidth, Screen.Height) End If Next End Sub MODULE DISPLAY Dim pass As Integer Private Sub Form_Activate() pass = 0 End Sub Private Sub Form_Click() ' hide display form if the user clicks the background Hide End Sub Private Sub Form_KeyPress(KeyAscii As Integer) 'hide display form if the user presses a key Hide End Sub Private Sub Form_Load() DrawWidth = 3 End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) ' hide display form if the user moves the mouse a small amount Static lastx As Single, lasty As Single If pass > 1 And (Abs(X - lastx) > 18 Or Abs(Y - lasty) > 18) Then Hide End If pass = pass + 1 lastx = X lasty = Y End Sub