Information générale
Catégorie:
Photos et traitement d'images
Titre:
Drawing shapes on forms
Hello, here is some code that draws a clock-shaped dial on a form. The hash-marks are different each time based upon parameters. It works well, but takes a bit too long to draw. Anyone see any clear ways to speed/refine this code up?
Thx, Seth
OpenDeg = 2.9
this.parent.cmdquit.setfocus()
counter = -0.050
PAPER=_SCREEN.ACTIVEFORM
PAPER.DRAWWIDTH=2
for xx = 90.5 to 448 step 3.6 &&100 Marks
IF COUNTER = 0
COUNTER = COUNTER + 0.001
ENDIF
if counter > thisform.max or counter < thisform.min
thisform.forecolor = rgb(255,0,0)
else
thisform.forecolor = rgb(66,192,0)
endif
for yy = 172 to 154 step -2 &&Draw colored blocks, line by line
PAPER.CURRENTX=thisform.shapebase1.left+(thisform.shapebase1.width/2)+(YY*COS(DTOR(XX)))
PAPER.CURRENTY=thisform.shapebase1.top+(thisform.shapebase1.height/2)+(YY*SIN(DTOR(XX)))
FOR angle = XX+1 TO XX+OpenDeg
PAPER.LINE(thisform.shapebase1.left+(thisform.shapebase1.width/2)+(YY*COS(DTOR(angle))),thisform.shapebase1.top+(thisform.shapebase1.height/2)+(YY*SIN(DTOR(angle))))
ENDFOR
endfor
counter = counter + 0.001
endfor
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement