try this example hope it helps
`..................Drawing.............
`------------------------------------------------------
`
`
`--------------------BY XMEN---------------------------
` FUNCTION EXAMPLE
`
`------------------------------------------------------
set display mode 800,600,16
dim colorit(1)
dim Clicked(1)
dim tool$(6)
tool$(1)="Box"
tool$(2)="Circle"
tool$(3)="Ellipse"
tool$(4)="Line"
tool$(5)="Bar"
tool$(6)="color"
sync on
create bitmap 1,bitmap width(0),bitmap height(0)
set current bitmap 0
colorit(1)=255
do
zone(1,9,10,"Box")
zone(2,42,10,"Circle")
zone(3,86,10,"Ellipse")
zone(4,137,10,"Line")
zone(5,171,10,"Bar")
zone(6,200,10,"color")
ink rgb(rgbr(colorit(1)),rgbg(colorit(1)),rgbb(colorit(1))),1
box 430,10,500,30
ink rgb(255,255,255),1
text 370,10,"USEING....... "+tool$(Clicked(0))
ink rgb(rgbr(colorit(1)),rgbg(colorit(1)),rgbb(colorit(1))),1
x=mousex():y=mousey()
if y>30
if Clicked(1)=1 and mouseclick()=1
box(x,y)
endif
if Clicked(1)=2 and mouseclick()=1
Circle(x,y)
endif
if Clicked(1)=3 and mouseclick()=1
Ellipse(x,y)
endif
if Clicked(1)=4 and mouseclick()=1
Line(x,y)
endif
if Clicked(1)=5 and mouseclick()=1
Bar(x,y)
endif
endif
if Clicked(1)=6 and mouseclick()=1
color
Clicked(1)=Clicked(0)
endif
sync
loop
`................................DRAW...EMPTY..BOX......................
FUNCTION BOX(x,y)
repeat
copy bitmap 1,0
x2=mousex():y2=mousey()
line x,y,x2,y
line x,y,x,y2
line x2,y,x2,y2
line x,y2,x2,y2
sync
until mouseclick()=0
copy bitmap 0,1
ENDFUNCTION
`................................DRAW.....CIRCLE.....................
FUNCTION CIRCLE(x,y)
repeat
copy bitmap 1,0
x2=mousex():y2=mousey()
CIRCLE x,y2,x2/3
sync
until mouseclick()=0
copy bitmap 0,1
ENDFUNCTION
`................................DRAW.....ELLIPSE.....................
FUNCTION ELLIPSE(x,y)
repeat
copy bitmap 1,0
x2=mousex():y2=mousey()
ELLIPSE X,Y,X2/3,Y2/3
sync
until mouseclick()=0
copy bitmap 0,1
ENDFUNCTION
`................................DRAW..LINE...........................
FUNCTION LINE(x,y)
repeat
copy bitmap 1,0
x2=mousex():y2=mousey()
LINE x,y,x2,y2
sync
until mouseclick()=0
copy bitmap 0,1
ENDFUNCTION
`.................................DRAW....BAR........................
FUNCTION BAR(x,y)
repeat
copy bitmap 1,0
x2=mousex():y2=mousey()
BOX x,y,x2,y2
sync
until mouseclick()=0
copy bitmap 0,1
ENDFUNCTION
`........................................COLOUR...................
FUNCTION COLOR()
ok=0
ink rgb(170,170,140),1
box 200,90,503,300
ink rgb(140,140,50),1
box 201,91,502,299
ink rgb(255,255,255),1
box 221,110,481,130
box 221,150,481,170
box 221,190,481,210
`............min...............
box 205,115,216,126
box 205,155,216,166
box 205,195,216,206
`............max..........
box 486,115,498,126
box 486,155,498,166
box 486,195,498,206
ink rgb(0,0,0),1
text 210,113,"-"
text 210,153,"-"
text 210,193,"-"
text 489,113,"+"
text 489,153,"+"
text 489,193,"+"
ink rgb(255,0,0),1:text 330,92,"Red"
ink rgb(0,255,0),1:text 327,132,"Green"
ink rgb(0,0,255),1:text 331,173,"Blue"
ink rgb(0,0,255),1:text 331,278,"Use"
ink rgb(0,0,0),1
ink rgb(0,0,0),1
box 291,214,391,271
repeat
ink rgb(0,0,0),1
box 222,111,480,129
box 222,151,480,169
box 222,191,480,209
mx=mousex()
my=mousey()
if mouseclick()=1 and mx>=331 and mx<=331+text width("Use") and my>=278 and my<=278+text height("Use")
text 331,278,".Use.."+str$(ok)
ok=1
colorit(1)=point(mx,my-50)
sync
copy bitmap 1,0
exitFunction
endif
`.................................Min..........
if mouseclick()=1 and mx>=205 and mx<=216 and my>=115 and my<=126 and red>0
red=red-1
endif
if mouseclick()=1 and mx>=205 and mx<=216 and my>=155 and my<=166 and green>0
green=green-1
endif
if mouseclick()=1 and mx>=205 and mx<=216 and my>=195 and my<=206 and blue>0
blue=blue-1
endif
`.................................Max..........
if mouseclick()=1 and mx>=486 and mx<=498 and my>=115 and my<=126 and red<255
red=red+1
endif
if mouseclick()=1 and mx>=486 and mx<=498 and my>=155 and my<=166 and green<255
green=green+1
endif
if mouseclick()=1 and mx>=486 and mx<=498 and my>=195 and my<=206 and blue<255
blue=blue+1
endif
ink rgb(red,green,blue),1
box 292,215,390,270
if red>0
ink rgb(red,0,0),1
box 223,112,223+red,129
endif
if green>0
ink rgb(0,green,0),1
box 223,152,223+green,169
endif
if blue>0
ink rgb(0,0,blue),1
box 223,192,223+blue,208
endif
ink rgb(255,255,255),1:
text 340,113,str$(red)
text 340,153,str$(green)
text 340,193,str$(blue)
sync
until ok=1
copy bitmap 1,0
ENDFUNCTION
`........................................MOUSE ZONE..............
FUNCTION ZONE(zonenum,x1,y1,zone$)
if zonenum<6 then ops=zonenum
backdrop off
sync rate 1000
ink rgb(120,120,120),1
box x1,y1,x1+text width(zone$)+4,y1+text height(zone$)+5
ink rgb(190,190,190),1
box x1+1,y1+1,x1+text width(zone$)+3,y1+text height(zone$)+4
ink rgb(0,0,0),1
text x1+3,y1+2,zone$
ink rgb(190,190,190),1
clicked=0
if mousex()>x1 and mousex()<x1+text width(zone$)+5
if mousey()>y1 and mousey()<y1+text height(zone$)+5
if mouseclick()=1
clicked=zonenum
Clicked(1)=zonenum
if zonenum<6 then Clicked(0)=zonenum
ink rgb(160,160,160),1
box x1+2,y1+2,x1+text width(zone$)+2,y1+text height(zone$)+3
ink rgb(115,115,115),1
line x1+2,y1+1,x1+text width(zone$)+2,y1+1
line x1+text width(zone$)+3,y1+1,x1+text width(zone$)+3,y1+text height(zone$)+3
ink rgb(0,0,0),1
text x1+3,y1+2,zone$
ink rgb(190,190,190),1
endif
endif
endif
ENDFUNCTION