VERSION 5.00 Begin VB.Form frmPeaceprint BackColor = &H00008000& Caption = "peace sign art designer. Makes a new drawing with every click." ClientHeight = 6705 ClientLeft = 60 ClientTop = 375 ClientWidth = 8850 FillColor = &H00800000& BeginProperty Font Name = "Arial Black" Size = 12 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty LinkTopic = "Form1" ScaleHeight = 26440.1 ScaleMode = 0 'User ScaleWidth = 8850 StartUpPosition = 3 'Windows Default Begin VB.CheckBox chkPrinter Caption = "turn on printer" BeginProperty Font Name = "Arial Black" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 465 Left = 6360 TabIndex = 5 Top = 3240 Width = 2175 End Begin VB.TextBox txtRepeat Height = 465 Left = 5640 TabIndex = 4 Text = "12" Top = 3240 Width = 495 End Begin VB.CommandButton cmdKali Caption = "Make drawing" BeginProperty Font Name = "Arial Black" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Left = 5880 TabIndex = 2 Top = 960 Width = 2535 End Begin VB.CommandButton cmdQuit Caption = "QUIT" BeginProperty Font Name = "MS Sans Serif" Size = 12 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 6120 TabIndex = 1 Top = 6120 Width = 2175 End Begin VB.PictureBox picOutput AutoRedraw = -1 'True BackColor = &H00FFFFFF& BeginProperty Font Name = "MS Sans Serif" Size = 12 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 6495 Left = 240 ScaleHeight = 6435 ScaleWidth = 5115 TabIndex = 0 Top = 120 Width = 5175 End Begin VB.Label Label3 Alignment = 2 'Center BackColor = &H00C0FFC0& Caption = "Push this button to see a new drawing." Height = 735 Left = 5640 TabIndex = 7 Top = 120 Width = 3015 End Begin VB.Label Label2 Alignment = 2 'Center BackColor = &H00C0FFC0& Caption = $"peaceprint.frx":0000 BeginProperty Font Name = "Courier" Size = 12 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 2175 Left = 5640 TabIndex = 6 Top = 3840 Width = 3015 End Begin VB.Label Label1 Alignment = 2 'Center BackColor = &H00C0FFC0& Caption = "Change this number to change the drawing. 1=few lines, 25= LOTS of lines... Changes COLORS TOO. Maximum number is 25." BeginProperty Font Name = "Courier" Size = 12 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00400040& Height = 1575 Left = 5640 TabIndex = 3 Top = 1560 Width = 3135 End End Attribute VB_Name = "frmPeaceprint" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False 'Visual Basic program that paints a 'PEACE SIGN on the screen... with optional printer... 'other Kaleidoscope programs can be found at: 'http://gregvan.tripod.com 'http://www.angelfire.com/art2/gregvan 'or just search google.com for "gregvan" I'm listed a lot... 'This project is called peaceprint.vbp 'this form is called peaceprint.frm 'fred1 and sue1 are used to store the random numbers 'so the printout will be identical to the monitor 'I put them outside of the cmdKali_Click so that they 'will not be reset to zero by clicking on the button START... Dim sue1 As Integer Dim fred1 As Integer '************************************* Private Sub cmdKali_Click() 'when you push the "Start Kaleidoscope" button 'this part of the program executes... Dim krsna As Single 'KRSNA IS A "SINGLE" TYPE VARIABLE BECAUSE i WANT TO ADD FRACTIONS TO IT. 'like krsna=krsna+.6 (6/10th) Dim fred As Integer, sue As Integer 'fred and sue are variables used for location of 'the endpoints of lines and to change the color also ' integers must be whole numbers like 4 or 72 with NO decimals ' 4.52 is a single and so is 23.123 Dim pete As Integer 'pete and petenum are used to control how many radiating lines are drawn Dim peteNum As Integer ' c and cc are used to calculate colors Dim c As Single 'these are used for HEXIDECIMAL NUMBERS Dim cc As Single ' like &hff2255 or &hdead00 Dim kc As Single 'the color of the big dot peace sign rests on peteNum = Val(txtRepeat) If peteNum < 1 Then peteNum = 12 If peteNum > 25 Then peteNum = 12 'get a number from the box on the screen 'and use it for a loop counter... default = 12 If chkPrinter.Value = 1 Then 'see if they have checked the "turn on printer" box 'we only want new random numbers when box is NOT checked Else Randomize 'generate some random numbers sue = Int(Rnd * 400) sue = sue - 200 'sue can be from -200 to 200 fred = Int(Rnd * 300) fred = fred - 150 'fred can be from -150 to 150 'store those numbers in sue1 and fred1 'so we can use them again if the printer checkbox is checked 'they control the color scheme... sue1 = sue fred1 = fred End If picOutput.Cls 'set the scale of the picture box 640 tall by 480 wide ' the lower left corner is 0,0 'the upper right corner is 480,640 picOutput.Scale (0, 640)-(480, 0) If chkPrinter.Value = 1 Then 'get those random numbers we saved 'so we can use them to drive the printer sue = sue1 fred = fred1 'set the printer scale... do this only when box is checked 'A MYSTERY HAPPENS WHEN I PRINT... 'THE PRINT IS BACKWARDS... THE LEFT HAND SIDE OF THE DRAWING PRINTS ON THE RIGHT !!! Printer.Scale (0, 640)-(480, 0) End If 'initialize up-down counter factors for endpoints of lines Dim suef As Integer 'suefactor suef = -4 Dim fredf As Integer 'fredfactor fredf = 6 'some loops to repeat the radial line plotting For re = 1 To 8 'you can change the value of peteNum by typing into a textbox during execution... For pete = 1 To peteNum For joe = 1 To pete 'up-down counter for fred...it increases fred until a threshhold 'is reached then it decreases fred until another threshhold is 'reached then it increases fred... "a triangle wave oscillator" fred = fred + fredf If fred < -400 Then fredf = 6 If fred > 400 Then fredf = -3 sue = sue + suef If sue > 350 Then suef = -4 If sue < -350 Then suef = 5 'do some math to change the color c = c + &H10203 'make sure the color number is valid 'the largest number for a color is 16 million decimal &hffffff hex 'hex numbers use base 16 (0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f) 'color are represented by a six digit hex number '&hffffff=white &h000000=black 2 digits each for red,green and blue If c > &HFFFFFF Then c = c - &HFFFFFF 'calculate the endpoints of the lines 'We use x to represent horizontal distances 'increasing from left to right 'We use y to represent vertical distances 'increasing from bottom to top...Just like geometry class x = fred + sue y = sue - fred 'draw the lines that radiate from the center of the drawing 'these show on the screen... 'picOutput.line(endpointX,Y)-(otherendpointX,Y),COLOR picOutput.Line (240 + x, 320 + y)-(240 - x, 320 - y), c picOutput.Line (240 - x, 320 + y)-(240 + x, 320 - y), c If chkPrinter.Value = 1 Then 'these are printed by the printer Printer.Line (240 + x, 320 + y)-(240 - x, 320 - y), c Printer.Line (240 - x, 320 + y)-(240 + x, 320 - y), c End If Next joe Next pete Next re 'draw a big spot for the peace sign to rest on kc = &HFFFFFF - (peteNum * &H100203) For krsna = 1 To 110 Step 0.1 picOutput.Circle (240, 320), krsna, kc If chkPrinter.Value = 1 Then Printer.Circle (240, 320), krsna, kc End If Next krsna Dim d As Single 'draw the peace sign 'the format for a circle is... 'picOutput.Circle(centerX,centerY),diameter,color 'some colors have names... vbBlack, vbRed, vbBlue, vbYellow For d = 1 To 20 Step 0.4 'a tiny step to make the peace symbol darker picOutput.Circle (240, 320), 100 + d, vbBlack picOutput.Line (230 + d, 200)-(230 + d, 440), vbBlack picOutput.Line (240, 320 + d)-(150 - d, 245 + d), vbBlack picOutput.Line (240, 320 + d)-(330 + d, 245 + d), vbBlack If chkPrinter.Value = 1 Then Printer.Circle (240, 320), 100 + d, vbBlack Printer.Line (230 + d, 200)-(230 + d, 440), vbBlack Printer.Line (240, 320 + d)-(150 - d, 245 + d), vbBlack Printer.Line (240, 320 + d)-(330 + d, 245 + d), vbBlack End If Next d 'make the color radically different than the radiating lines 'draw a border near the edge of the paper cc = &HFFFFFF - c For t = 0 To (400 - (peteNum * 15)) Step 2 cc = cc + &H30211 If cc > &HFFFFFF Then cc = cc - &HFFFFFF picOutput.Line (300 - t, 0)-(0, 0 + t), cc picOutput.Line (180 + t, 0)-(480, 0 + t), cc picOutput.Line (300 - t, 640)-(0, 640 - t), cc picOutput.Line (180 + t, 640)-(480, 640 - t), cc If chkPrinter.Value = 1 Then Printer.Line (300 - t, 0)-(0, 0 + t), cc Printer.Line (180 + t, 0)-(480, 0 + t), cc Printer.Line (300 - t, 640)-(0, 640 - t), cc Printer.Line (180 + t, 640)-(480, 640 - t), cc End If Next t Dim hal As Integer 'hal-the computer in 2001 'draw pyramids as part of the frame For ha = 0 To (110 - (peteNum * 4)) Step 1 hal = ha + ha + ha + ha 'much humor here... cc = cc + &H112233 'color changer If cc > &HFFFFFF Then cc = cc - &HFFFFFF 'top and bottom pyramids picOutput.Line (120 + hal, 0)-(240, ha), cc picOutput.Line (360 - hal, 0)-(240, ha), cc picOutput.Line (120 + hal, 640)-(240, 640 - ha), cc picOutput.Line (360 - hal, 640)-(240, 640 - ha), cc 'side pyramids picOutput.Line (0, 200 + hal)-(ha, 320), cc picOutput.Line (0, 440 - hal)-(ha, 320), cc picOutput.Line (480, 200 + hal)-(480 - ha, 320), cc picOutput.Line (480, 440 - hal)-(480 - ha, 320), cc If chkPrinter.Value = 1 Then 'top and bottom pyramids Printer.Line (120 + hal, 0)-(240, ha), cc Printer.Line (360 - hal, 0)-(240, ha), cc Printer.Line (120 + hal, 640)-(240, 640 - ha), cc Printer.Line (360 - hal, 640)-(240, 640 - ha), cc 'side pyramids Printer.Line (0, 200 + hal)-(ha, 320), cc Printer.Line (0, 440 - hal)-(ha, 320), cc Printer.Line (480, 200 + hal)-(480 - ha, 320), cc Printer.Line (480, 440 - hal)-(480 - ha, 320), cc End If Next ha End Sub '************************************************* 'this part happens when you push the quit button... Private Sub cmdQuit_Click() Unload frmPeaceprint End End Sub