DrawBezier Method [Visio 2003 SDK Documentation]
Creates a new shape whose path is defined by the supplied sequence of Bezier control points.
objRet = object**.DrawBezier**(xyArray, degree, flags)
objRet The new Shape object.
object Required. The page, master, or group in which to draw the shape.
xyArray Required Double. An array of alternating x and y values that define the Bezier control points for the new shape.
degree Required Integer. The degree of the Bezier curve.
flags Required Integer. Flags that influence how the shape is drawn.
Version added
4.1
Remarks
The xyArray and degree parameters must meet the following conditions:
1 <= degree <= 9
The number of points must be k * degree + 1, where k is a positive integer. If the first point is called p0, for any integer m between 1 and k, p(m * degree) is assumed to be the last control point of a Bezier segment, as well as the first control point of the next.
The result is a composite curve that consists of k Bezier segments. The input points from xyArray define the curve's control points. If you want a smooth curve, make sure the points p(n - 1), pn, and p(n + 1) are co-linear whenever n = m * degree with an integer m. The composite Bezier curve is represented in the application as a B-spline with integer knots of multiplicity = degree.
The control points should be in internal drawing units (inches) with respect to the coordinate space of the page, master, or group where the shape is being drawn. The passed array should be a type SAFEARRAY of 8-byte floating point values passed by reference (VT_R8|VT_ARRAY|VT_BYREF). This is how Microsoft Visual Basic passes arrays to Automation objects.
The flags argument is a bit mask that specifies options for drawing the new shape. Its value should be zero (0) or visSpline1D (8).
If flags is visSpline1D and the first and last points in xyArray don't coincide, the DrawBezier method produces a shape with one-dimensional (1-D) behavior; otherwise, it produces a shape with two-dimensional (2-D) behavior.
If the first and last points in xyArray do coincide, the DrawBezier method produces a filled shape.
Example
The following example shows how to draw a Bezier curve through five arbitrary points on the active page.
Public Sub DrawBezier_Example()
Dim vsoShape As Visio.Shape
Dim intCounter As Integer
Dim adblXYPoints(1 To (5 * 2)) As Double
For intCounter = 1 To 5
'Set x coordinates (array elements 1,3,5,7,9) to 1,2,3,4,5
adblXYPoints((intCounter * 2) - 1) = intCounter
'Set y coordinates (array elements 2,4,6,8,10) to f(intCounter)
adblXYPoints(intCounter * 2) = (intCounter * intCounter) - (7 * intCounter) + 15
Next intCounter
Set vsoShape = ActivePage.DrawBezier(adblXYPoints, 2, visSpline1D)
End Sub
Applies to | Master object | Page object | Shape object