Class

CurveShape


Description

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

Property descriptions


CurveShape.BorderColor

BorderColor As Color

The color of the object's border.


CurveShape.BorderOpacity

BorderOpacity As Double

Indicates the level of opacity.

Degrees of transparency is currently supported only on macOS and Windows. On other platforms, the border is either visible (100%) or invisible.

The following code adds a border to an ArcShape:

Var a As New ArcShape
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.BorderOpacity = 100
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

CurveShape.BorderWidth

BorderWidth As Double

The width of the border, in points. The default is 1.

The width a Double value with a default of 1.0.


CurveShape.ControlX

ControlX As Double

Use the zero-based index to access control points (horizontal position).

The following method is in the MouseDown event of a Window. It draws a simple curve when the user presses the mouse button. 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)

CurveShape.ControlY

ControlY As Double

Use the zero-based index to access control points (vertical position).

The following method is in the Paint event of a Window. It draws a simple curve when the user presses the mouse button. 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)

CurveShape.FillColor

FillColor As Color

The color of the interior of the shape.


CurveShape.FillOpacity

FillOpacity As Double

The opacity of the interior, from 0 (completely transparent) to 100 (opaque).

This example sets the Fill to 50% opacity.

Var a As New ArcShape
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.BorderOpacity = 100
a.BorderColor = &c0000ff
a.BorderWidth = 2.75
a.FillOpacity = 50
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

CurveShape.Order

Order As Integer

The number of off-curve control points that are used.

It is one of the following values:

Value

Description

0

A straight line from x,y to x2,y2 is used.

1

A quadratic Bezier curve is drawn using one control point.

2

A cubic Bezier curve is drawn using two control points.

The following method is in the MouseDown event of a Window. It draws a simple curve when the user presses the mouse button. 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)

CurveShape.Rotation

Rotation As Double

Clockwise rotation, in radians, around the X, Y point. Only set the rotation after you have drawn all your objects.

This code rotates the arc 0.9 radians.

Var a As New ArcShape
a.Height = 150
a.Width = 150
a.Rotation = 0.90
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.Border = 100
a.BorderColor = &c0000ff
a.BorderWidth = 2.75
a.Fill = 50
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

CurveShape.Scale

Scale As Double

The scaling factor relative to the object's original size.

The following code rescales the arc by a factor of 1.5.

Var a As New ArcShape
a.Scale = 1.5
a.Rotation = .90
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.Border = 100
a.BorderColor = &c0000ff
a.BorderWidth = 2.75
a.Fill = 50
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

CurveShape.Segments

Segments As Integer

The number of straight line segments to use to approximate a curve. The default value of zero will cause a "sensible" number of segments to be used.

The following method is in the MouseDown event of a Window. It draws a simple curve when the user presses the mouse button. 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.Segments = 3
c.X = 10
c.Y = 100
c.X2 = 250
c.Y2 = 100

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

CurveShape.X

X As Double

The horizontal position of the center or main anchor point.

This example sets the horizontal position to 100 pixels from the left of the containing Canvas.

Var a As New ArcShape
a.Height = 150
a.Width = 150
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.X = 100
a.Border = 100
a.BorderColor = &c0000ff
a.Fill = 50
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

CurveShape.X2

X2 As Double

The horizontal position of the end of the line or curve.

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)

CurveShape.Y

Y As Double

The vertical position (down from top) position of the center or anchor point.

This example moves the position of the arc down 100 pixels from the top of the containing Canvas.

Var a As New ArcShape
a.Height = 150
a.Width = 150
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.Y = 100
a.Border = 100
a.BorderColor = &c0000ff
a.Fill = 50
a.FillColor = Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)

CurveShape.Y2

Y2 As Double

The vertical position of the end of the line or curve.

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)

Notes

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)

Compatibility

Desktop and web project types on all supported operating systems.