From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Class (inherits from Object2D)

Used for drawing lines and curves in a vector graphics environment.

BorderColor FillColor Segments
BorderOpacity FillOpacity X
BorderWidth Order X2
ControlX Rotation Y
ControlY Scale Y2


For CurveShapes, the default value for the BorderOpacity property is 100 and the default value for FillColor is 0.

When you set Order to zero, you get a straight line from x,y to x2, y2. You use control points when you want to 'bend' the line in a particular way. When you set Order to 1, the line bends towards ControlX(0),ControlY(0) on its way from X,Y to X2,Y2. This is what happens in the example. The further away the control point is, the more the line will deviate in that direction.

If Order is set to 2, there are two control points. The line will bend first towards ControlX(0),ControlY(0), and then towards ControlX(1),ControlY(1). At the end points, the curve points directly at the associated control point. The curve is guaranteed to always stay within the polygon formed by the endpoints and the control points (if any).

Sample Code

The following method is in the Paint event of a Window. It draws a simple curve. The negative value of ControlY(0) places the control point above the imaginary straight line from x,y to x2,y2.

Var c As New CurveShape
c.ControlX(0) = 120
c.ControlY(0) = -40
c.Order = 1
c.X = 10
c.Y = 100
c.X2 = 250
c.Y2 = 100

g.DrawObject(c, c.X, c.Y)

See Also

FigureShape, FolderItem, Group2D, Graphics, Object2D, OvalShape, Picture, PixmapShape, RectShape, RoundRectShape, TextShape classes.