Curve.Point 方法 (Visio)
會傳回曲線上某個位置的點。
語法
運算式。Point (t、 x、 y)
表達 代表 Curve 物件的變數。
參數
名稱 | 必要/選用 | 資料類型 | 描述 |
---|---|---|---|
t | 必要 | 雙精確度 | 曲線的參數範圍中要評估的值 |
x | 必要 | 雙精確度 | 在t傳回曲線的 x值。 |
y | 必要 | 雙精確度 | 在t傳回曲線的y值。 |
傳回值
無
註解
Curve 物件是透過參數範圍來描述,此參數範圍是 [Start(),End()]。 Curve物件的Point方法會傳回位於位置 t的x,y座標,也就是沿著曲線路徑的任何位置。 Point 方法可用於推斷曲線延伸到 [Start(),End()] 之外的路徑。
範例
本 Microsoft Visual Basic for Applications (VBA) 巨集會在文件的使用中頁面上繪製圓形 (可視為一種特殊的橢圓)。 然後它會重複圓形的 Paths 集合及每個 Path 物件,以顯示曲線上各點的座標。 因為繪製的是圓形圖形,所以會是只有一個路徑的 Curve 物件。
Sub Point_Example()
Dim vsoShape As Visio.Shape
Dim vsoPaths As Visio.Paths
Dim vsoPath As Visio.Path
Dim vsoCurve As Visio.Curve
Dim dblEndpoint As Double
Dim dblXCoordinate As Double
Dim dblYCoordinate As Double
Dim intOuterLoopCounter As Integer
Dim intInnerLoopCounter As Integer
'Get the Paths collection for this shape.
Set vsoPaths = ActivePage.DrawOval(1, 1, 4, 4).Paths
'Iterate through the Path objects in the Paths collection.
For intOuterLoopCounter = 1 To vsoPaths.Count
Set vsoPath = vsoPaths.Item(intOuterLoopCounter)
Debug.Print "Path object " & intOuterLoopCounter
'Iterate through the curves in the Path object.
For intInnerLoopCounter = 1 To vsoPath.Count
Set vsoCurve = vsoPath(intInnerLoopCounter)
Debug.Print "Curve number " & intInnerLoopCounter
'Display the endpoint of the curve
dblEndpoint = vsoCurve.End
Debug.Print "Endpoint= " & dblEndpoint
'Use the Point method to determine the
'coordinates of an arbitrary point on the curve
vsoCurve.Point (dblEndpoint/2), dblXCoordinate, dblYCoordinate
Debug.Print "Point= " & dblXCoordinate, dblYCoordinate
Next intInnerLoopCounter
Debug.Print "This path has " & intInnerLoopCounter - 1 & " curve object(s)."
Next intOuterLoopCounter
Debug.Print "This shape has " & intOuterLoopCounter - 1 & " path object(s)."
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。