Table of contents
Collapse the table of content
Expand the table of content

Page.DrawBezier Method (Visio)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Creates a shape whose path is defined by the supplied sequence of Bezier control points.


expression . DrawBezier( xyArray() , degree , Flags )

expression A variable that represents a Page object.


NameRequired/OptionalData TypeDescription
xyArray()RequiredDoubleAn array of alternating x and y values that define the Bezier control points for the new shape.
degreeRequiredIntegerThe degree of the Bezier curve.
FlagsRequiredIntegerFlags that influence how the shape is drawn.

Return Value



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 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 bitmask 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.


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
© 2017 Microsoft