Visio) (Cell.GlueToPos 方法
將一個圖形從第一個圖形的儲存格黏附到第二個圖形中的 x、 y 位置。
語法
運算式。GlueToPos (SheetObject、 xPercent、 yPercent)
表達 代表 Cell 物件的變數。
參數
名稱 | 必要/選用 | 資料類型 | 描述 |
---|---|---|---|
SheetObject | 必要 | [IVSHAPE] | 會傳回黏附目標的 Shape 物件的運算式 |
xPercent | 必要 | 雙精確度 | 黏附目標的 X 座標位置 |
yPercent | 必要 | 雙精確度 | 黏附目標的 Y 座標位置 |
傳回值
無
註解
GlueToPos 方法會在 xPercent 及 yPercent 所決定的位置建立新的連接點,這兩個值分別代表指定之圖形的寬度及高度百分比,而不是座標。 例如,下列程式碼會在 SheetObject 的中心建立連接點,並將 cellObject 所代表的圖形部分黏附至該點:
cellObject。 GlueToPosSheetObject, 0.5, 0.5
遮蔽 Controls 區段列或 BeginX 或 EndX 儲存格的 X 儲存格,會分別自動黏附 Controls 區段列或 BeginY 或 EndY 儲存格的 Y 儲存格。 (反向也是 true.)
範例
下列範例會顯示如何使用 GlueToPos 方法將圖形黏附在一起。
Public Sub GlueToPos_Example()
Dim vso1DShape As Visio.Shape
Dim vso2DShape1 As Visio.Shape
Dim vso2DShape2 As Visio.Shape
Dim vsoCellGlueFromBegin As Visio.Cell
Dim vsoCellGlueFromEnd As Visio.Cell
'Draw a line.
Set vso1DShape = ActivePage.DrawLine(3, 5, 5, 3)
'Draw the lower rectangle.
Set vso2DShape1 = ActivePage.DrawRectangle(1, 1, 4, 2)
'Draw the upper rectangle.
Set vso2DShape2 = ActivePage.DrawRectangle(5, 5, 8, 6)
'Get the Cell objects needed to make the connections.
Set vsoCellGlueFromBegin = vso1DShape.Cells("BeginX")
Set vsoCellGlueFromEnd = vso1DShape.Cells("EndX")
'Use the GlueToPos method to glue the begin point of the 1D shape
'to the top center of the lower 2D shape.
vsoCellGlueFromBegin.GlueToPos vso2DShape1, 0.5, 1
'Use the GlueToPos method to glue the endpoint of the 1D shape
'to the bottom center of the upper 2D shape.
vsoCellGlueFromEnd.GlueToPos vso2DShape2, 0.5, 0
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。