Table of contents

Page.DrawBezier 方法 (Visio)Page.DrawBezier Method (Visio)

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

创建一个形状,其路径由提供的贝赛尔控制点序列定义。Creates a shape whose path is defined by the supplied sequence of Bezier control points.


表达式DrawBezier( xyArray()标志)expression . DrawBezier( xyArray() , degree , Flags )

表达式_一个表示一个Page对象的变量。_expression A variable that represents a Page object.


名称Name必需/可选Required/Optional数据类型Data Type说明Description
xyArray()xyArray()必需RequiredDoubleDouble一个交替出现_x_和_y_值来定义新形状的贝赛尔控制点的数组。An array of alternating x and y values that define the Bezier control points for the new shape.
degree必需RequiredIntegerInteger贝赛尔曲线的曲度。The degree of the Bezier curve.
FlagsFlags必需RequiredIntegerInteger影响形状绘制方式的标志。Flags that influence how the shape is drawn.

返回值Return Value



XyArray()_和_度_参数必须满足以下条件:The _xyArray() and degree parameters must meet the following conditions:

1 < =< = 91 <= degree <= 9

点的数目必须是 k * degree + 1,其中, k_是一个正整数。如果第一个点称为_p0 ,对于 1 和_k_之间的任意整数_m_ ,则假定_p(m * degree)是最后的控制点的贝塞尔线段,以及接下来的第一个控制点。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.

其结果是复合曲线的_k_贝赛尔曲线段组成。从_xyArray()的输入的点定义曲线的控制点。如果要平滑曲线,请确保_pn ,点_p (n-1) , _p(n + 1) co 线性只要_n = m * 度_具有整数_m_ 。复合的贝塞尔曲线表示在应用程序中的 B-样条与整数_节点_的_重数度 =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 .

控制点应该使用在其中绘制形状的页面、主控形状或组的坐标空间的内部绘图单位(英寸)。传递的数组应该是 SAFEARRAY 类型的由引用 (VT_R8|VT_ARRAY|VT_BYREF) 传递的 8 字节浮点值。这是 Microsoft Visual Basic 向自动对象传递数组的方式。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.

Flags_参数是一个位掩码,指定用于绘制新建形状的选项。其值应为零 (0) 或visSpline1D (8)。The _Flags argument is a bitmask that specifies options for drawing the new shape. Its value should be zero (0) or visSpline1D (8).

如果_标志_是visSpline1D和_xyArray()中的第一个和最后一个点不重合, DrawBezier方法生成的形状与一维 (1-d) 行为;否则,它将生成二维 (2-d) 行为的形状。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.

如果在_xyArray()中的第一个和最后一个点做重合, DrawBezier方法可生成一个填充的形状。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
© 2018 Microsoft