version 5.80 0 Form1 1 4 0 0 12 13 0 0 1 0 0 0 10 0 0 0 0 1 0 0 238 268 0 0 0 Sub designer addform(Form1,"GraPPC","",220,220,220)@ addimage(form1,currcol,87,176,10,10,"cCenterImage","",0,0,0,True,True)@ addimage(form1,Image11,86,175,12,12,"cCenterImage","",0,0,0,True,True)@ addimage(form1,col7,73,176,10,10,"cCenterImage","",0,255,255,True,True)@ addimage(form1,col6,63,176,10,10,"cCenterImage","",255,0,255,True,True)@ addimage(form1,col5,53,176,10,10,"cCenterImage","",255,255,0,True,True)@ addimage(form1,col4,43,176,10,10,"cCenterImage","",0,0,255,True,True)@ addimage(form1,col3,33,176,10,10,"cCenterImage","",0,255,0,True,True)@ addimage(form1,col2,23,176,10,10,"cCenterImage","",255,0,0,True,True)@ addimage(form1,col1,13,176,10,10,"cCenterImage","",0,0,0,True,True)@ addimage(form1,col0,3,176,10,10,"cCenterImage","",255,255,255,True,True)@ addlabel(form1,Label2,200,175,35,10,"Y : 0",220,220,220,0,0,0,True,True,7)@ addlabel(form1,Label1,165,175,35,10,"X : 0",220,220,220,0,0,0,True,True,7)@ addimage(form1,Image10,2,175,82,12,"cCenterImage","",0,0,0,True,True)@ r addmenuitem(form1,Draw,"Draw",True,False)@r addmenuitem(draw,drw0,"FreeHand",True,True)@r addmenuitem(draw,drw1,"Circle",True,False)@r addmenuitem(draw,drw2,"Line",True,False)@r addmenuitem(draw,drw3,"BackSlash",True,False)@r addmenuitem(draw,drw4,"Rectangle",True,False)@r addmenuitem(form1,Edit,"Edit",True,False)@r addmenuitem(edit,ClearAll,"Clear All",True,False)@ End Sub @EndOfDesignText@'************************* '*** Graphics in B4PPC *** '************by forisco*** Sub Globals 'Declare the global variables here. Dim typeDraw: Dim buttonOn: Dim cR, cG, cB: Dim arrayColor(8), arrayComponent(3) Dim x0, y0: Dim rad: Dim x1, y1: Dim idx: Dim dws End Sub Sub App_Start 'Set the variables typeDraw = 0: buttonOn = 0: cR = 0: cG = 0: cB = 0: typeDraw = 0: dws = 4 arrayColor(0)="255,255,255": arrayColor(1)="0,0,0": arrayColor(2)="255,0,0": arrayColor(3)="0,255,0" arrayColor(4)="0,0,255": arrayColor(5)="255,255,0": arrayColor(6)="255,0,255": arrayColor(7)="0,255,255" Form1.Line (2,2,238,173,cWhite,BF) For t=0 To 7: AddEvent("col"&t,Click,"clickColor"): Next t For t=0 To dws: AddEvent("drw"&t,Click,"clickDraw"): Next t Form1.ForeLayer = True: Form1.Show End Sub Sub Form1_MouseDown (x,y) 'Set the origin of click If buttonOn=0 AND x>=2 AND x<=238 AND y>=2 AND y<=173 Then x0=x: y0=y: buttonOn = 1 End If End Sub Sub Form1_MouseMove (x,y) 'Drawing on the screen If x>=2 AND x<=238 AND y>=2 AND y<=173 Then label1.text="X : " & x: label2.text="Y : " & y If buttonOn=1 Then If typeDraw = 0 Then Form1.Line (x0, y0, x, y, cR, cG, cB): x0=x: y0=y End If If typeDraw = 1 Then Form1.FErase(0,0,238,319) rad = Sqrt((x-x0)^2+(y-y0)^2): Form1.FCircle(x0,y0,rad, cR, cG, cB) End If If typeDraw = 2 Then Form1.FErase(2,2,238,173) x1=x: y1=y: Form1.FLine (x0, y0, x1, y1, cR, cG, cB) End If If typeDraw = 3 Then Form1.Line (x-5, y-5, x, y, cR, cG, cB): x0=x: y0=y End If If typeDraw = 4 Then Form1.FErase(2,2,238,173) x1=x: y1=y: Form1.FLine (x0, y0, x1, y1, cR, cG, cB, B) End If End If End If End Sub Sub Form1_MouseUp (x,y) 'Stop the drawing buttonOn = 0 fixForeLayer End Sub Sub clickColor 'Set the color of the brush arrayComponent() = StrSplit(arrayColor(SubString(Sender,3,1)), ",") cR = arrayComponent(0): cG = arrayComponent(1): cB = arrayComponent(2) currcol.Color = cR,cG,cB End Sub Sub fixForeLayer 'Fix the changes to ForeLayer in the Form1 (not yet for the freehand and for the backslash) If typeDraw = 0 Then 'Form1.Line (x0, y0, x, y, cR, cG, cB): x0=x: y0=y End If If typeDraw = 1 Then Form1.Circle(x0,y0,rad, cR, cG, cB) End If If typeDraw = 2 Then Form1.Line (x0, y0, x1, y1, cR, cG, cB) End If If typeDraw = 3 Then 'Form1.Line (x-5, y-5, x, y, cR, cG, cB): x0=x: y0=y End If If typeDraw = 4 Then Form1.Line (x0, y0, x1, y1, cR, cG, cB, B) End If End Sub Sub clickDraw 'Select the drawing style idx=SubString(Sender,3,1): Control("drw"&idx).Checked = True For t=0 To dws If t<>idx Then Control("drw"&t).Checked = False Next t typeDraw = idx End Sub Sub ClearAll_Click 'Clear the screen and the forelayer Form1.Line (2,2,238,173,cWhite,BF) Form1.FErase (2,2,238,173) End Sub