建立代表新自由形狀繪圖的 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 支援與意見反應。