CurveShape

From Xojo Documentation
Jump to: navigation, search

Class (inherits from Object2D)

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

Properties
Border Fill Segments
BorderColor FillColor X
BorderWidth Order X2
ControlX Rotation Y
ControlY Scale Y2

Notes

For CurveShapes, the default value for the Border property is 100 and the default value for Fill 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).

Example

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.

Dim 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)

The curve looks like this:

A CurveShape object.

See Also

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

Personal tools
Namespaces

Variants
Actions
Main
Content
Starting Out
Dig Deeper
More Help
Toolbox
About