VERSION 4.00 Begin VB.Form frmPeaceprint BackColor = &H00808000& Caption = "peace sign art designer. Makes a new drawing with every click." ClientHeight = 6705 ClientLeft = 300 ClientTop = 510 ClientWidth = 8850 FillColor = &H00800000& BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Arial Black" Size = 12 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 7110 Left = 240 LinkTopic = "Form1" ScaleHeight = 6705 ScaleMode = 0 'User ScaleWidth = 8850 Top = 165 Width = 8970 Begin VB.CheckBox chkPrinter Caption = "turn on printer" BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 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 {0BE35203-8F91-11CE-9DE3-00AA004BB851} 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 {0BE35203-8F91-11CE-9DE3-00AA004BB851} 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 BackColor = &H00C0C000& BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 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 = $"peaceprint1.frx":0000 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 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, 25= LOTS of circles... Changes COLORS TOO. Maximum number is 25." BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 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_Creatable = False 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() 'Hindu god of Kali-dough-scopes 'when you push the "Make drawing" 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 Dim zappa As Integer 'circle diameter for background ' 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 picOutput.DrawMode = 13 'copypen is the standard mode 'you may also use other numbers like 6 is invert DoEvents 'I want to read the textbox now peteNum = Val(txtRepeat) If peteNum < 1 Then peteNum = 12 If peteNum > 25 Then peteNum = 12 'get a number from the box on the screen 'math to set color scheme... read the number on the screen 'and use it to set the color of the big dot behind the peace sign kc = &HFFFFFF - (peteNum * &H100203) c = kc 'since this value is close to &hffffff it is a PASTEL COLOR zappa = peteNum 'reset circle diameter so that printed image matches display 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 locations of background lines and circles sue1 = sue fred1 = fred End If picOutput.Cls 'clear the screen '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 = -3 Dim fredf As Integer 'fredfactor fredf = 2 '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 < -200 Then fredf = 2 If fred > 200 Then fredf = -3 sue = sue + suef If sue > 250 Then suef = -4 If sue < -250 Then suef = 5 'do some math to change the color '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 c = c + &H10203 'make sure the color number is valid 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 zappa = zappa + 5 'increase the diameters quickly If zappa > 160 Then zappa = 10 'diameters must be >0 positive 'draw the lines that radiate from the center of the drawing 'general form for a line '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 'general form for a circle 'picoutput.circle (center locationX,Y),Diameter,Color picOutput.Circle (x, y), zappa, c picOutput.Circle (480 - x, y), zappa, c picOutput.Circle (x, 640 - y), zappa, c picOutput.Circle (480 - x, 640 - y), zappa, 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 Printer.Circle (x, y), zappa, c Printer.Circle (480 - x, y), zappa, c Printer.Circle (x, 640 - y), zappa, c Printer.Circle (480 - x, 640 - y), zappa, c End If Next joe Next pete Next re 'draw a big spot for the peace sign to rest on 'use a tiny step value to make dot opaque picOutput.DrawMode = 5 'mask pen not... sort of an invert drawing For krsna = 1 To 135 Step 0.2 picOutput.Circle (240, 320), krsna, kc If chkPrinter.Value = 1 Then Printer.Circle (240, 320), krsna, kc End If Next krsna picOutput.DrawMode = 13 'normal... copy pen... 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, vbWhite picOutput.Line (230 + d, 200)-(230 + d, 440), vbWhite picOutput.Line (240, 320 + d)-(150 - d, 245 + d), vbWhite picOutput.Line (240, 320 + d)-(330 + d, 245 + d), vbWhite If chkPrinter.Value = 1 Then Printer.Circle (240, 320), 100 + d, vbWhite Printer.Line (230 + d, 200)-(230 + d, 440), vbWhite Printer.Line (240, 320 + d)-(150 - d, 245 + d), vbWhite Printer.Line (240, 320 + d)-(330 + d, 245 + d), vbWhite 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 picOutput.DrawMode = 6 'mask not pen 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 picOutput.DrawMode = 13 'normal... copy pen... 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