|
UpperRightCorner 示例 |
使用 VBA 以外的其它编程语言
Sub Example_UpperRightCorner()
' This example creates a new viewport and makes it active.
' Then it splits the viewport into 4 windows.
' It then takes finds the upper right corner of each of the
' windows.
Dim newViewport As AcadViewport
' Create a new viewport and make it active
Set newViewport = ThisDrawing.Viewports.Add("TESTVIEWPORT")
ThisDrawing.ActiveViewport = newViewport
' Split the viewport in 4 windows
newViewport.Split acViewport4
' Make the newly split viewport active
ThisDrawing.ActiveViewport = newViewport
' Iterate through the viewports. For each viewport,
' make that viewport active and display the coordinates
' of the upper right corner.
Dim entry As AcadViewport
Dim UpperRight As Variant
For Each entry In ThisDrawing.Viewports
entry.GridOn = True
ThisDrawing.ActiveViewport = entry
UpperRight = entry.UpperRightCorner
MsgBox "The upper right corner of this viewport is " & UpperRight(0) & ", " & UpperRight(1), , "UpperRightCorner 示例"
entry.GridOn = False
Next
End Sub