Graphics FigureShape question.

I want to draw a triangle in my window paint method.

I want to draw it in a ‘logo’ like fashion.
i.e.

MoveTo x1, y1
for i=1 to 3
Forward Length
Rotate sixtyDegrees
next i

Suggestions?

Are you saying you want the user to see an animation of the triangle being drawn?

no… I just want to see the lines as would be drawn and have a ‘psuedo’ logo language.

I think you’re saying you want to draw in a scaleable vector-based way without having to specify each pixel as you would with graphics.DrwPolygon.
See the vector graphics drawing tools: Object2D FigureShape. This example appears on that page.

Dim fx as New FigureShape
fx.AddLine 0, 100, 50, 0
fx.AddLine 50, 0, -50, 0
fx.Border = 100 // opaque border
fx.BorderColor = &cFF0000 // red border
fx.FillColor = &cFFFF00 // yellow interior
g.DrawObject fx, 100,100

the figureshape seems to have properties x and y.
are these the current position?
i.e. would a lineto method look like
fx.addline fx.x, fx.y, x2, y2

The X and Y properties represent a center/anchor-point of the figure shape. To get the last most point added you can do this…

dim lastX, lastY As integer if fs.Count > 0 then dim cs As CurveShape = fs.Item(fs.Count-1) lastX = cs.X2 lastY = cs.Y2 end //lastX and lastY are now the last most coordinates added, or <0, 0> if the fs is empty

How much of turtle graphics do you want to implement? A figure shape by itself won’t allow for pen up/down or size and color changes, instead you’ll need a group2d. And you’ll need something to track the current direction/heading/angle.

just the basics… Then I was thinking that using xojo script it could be a cool teaching tool for kids…