Shapes.BuildFreeform 方法 (Project)
创建一个 FreeformBuilder 对象,该对象代表新的任意多边形绘图。 任意多边形绘图可以转换为 Shape 对象。
语法
expression。
BuildFreeform
(EditingType,X1,Y1)
expression:一个表示 Shapes 对象的变量。
参数
名称 | 必需/可选 | 数据类型 | 说明 |
---|---|---|---|
EditingType | 必需 | MsoEditingType | 第一个顶点的编辑属性。 |
X1 | 必需 | Single | 自由多边形绘图中第一个节点) 相对于报表左边缘的位置 (磅。 |
Y1 | 必需 | Single | 自由多边形绘图中第一个节点) 相对于报表上边缘的位置 (以磅为单位。 |
EditingType | 必需 | MSOEDITINGTYPE | |
X1 | 必需 | FLOAT | |
Y1 | 必需 | FLOAT | |
名称 | 必需/可选 | 数据类型 | 说明 |
返回值
FreeformBuilder
备注
使用 AddNodes 方法添加到任意多边形的线段。 向任意多边形添加至少一个段后,可以使用 ConvertToShape 方法将 FreeformBuilder 对象转换为具有定义的几何说明的 Shape 对象。
示例
以下示例向报表添加一个具有五个顶点的任意多边形,将任意多边形转换为形状,然后更改形状的背景样式。
Sub AddFreeform2()
Dim shapeReport As Report
Dim reportName As String
Dim freeformBuild As FreeformBuilder
Dim freeformShape As shape
reportName = "Freeform2 report"
Set shapeReport = ActiveProject.Reports.Add(reportName)
Set freeformBuild = shapeReport.Shapes.BuildFreeform(msoEditingCorner, 360, 200)
With freeformBuild
.AddNodes msoSegmentCurve, msoEditingCorner, 380, 230, 400, 450, 300
.AddNodes msoSegmentCurve, msoEditingAuto, 480, 200
.AddNodes msoSegmentLine, msoEditingAuto, 480, 400
.AddNodes msoSegmentLine, msoEditingAuto, 360, 200
.ConvertToShape
End With
Set freeformShape = shapeReport.Shapes(1)
freeformShape.BackgroundStyle = msoBackgroundStylePreset10
End Sub
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。