UpperRightCorner 属性 (ActiveX)
获取当前活动视口的右上角。 支持的平台:仅限 Windows 属性值只读:是的 类型:变体(双精度的两个元素数组) 表示当前活动视口右上角的 2D 坐标。 言论and 属性表示视口在显示器上的图形位置。这些属性定义如下:LowerLeftCornerUpperRightCorner ![]() 视口 1— = (0, .5), = (.5, 1)LowerLeftCornerUpperRightCorner 视口 2— = (.5, .5), = (1, 1)LowerLeftCornerUpperRightCorner 视口 3— = (0, 0), = (.5, .5)LowerLeftCornerUpperRightCorner 视口 4— = (.5, 0), = (1, .5)LowerLeftCornerUpperRightCorner 例子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 Example" entry.GridOn = False Next End Sub 可视化 LISP: (vl-load-com) (defun c:Example_UpperRightCorner() ;; This example creates a new viewport and makes it active. ;; Then it splits the viewport into four windows. ;; It then finds the lower-left corner of each of the ;; windows. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Create a new viewport and make it active (setq newViewport (vla-Add (vla-get-Viewports doc) "TESTVIEWPORT")) (vla-put-ActiveViewport doc newViewport) ;; Split the viewport in four windows (vla-Split newViewport acViewport4) ;; Make the newly split viewport active (vla-put-ActiveViewport doc newViewport) ;; Iterate through the viewports. For each viewport, ;; make that viewport active and display the coordinates ;; of the upper right corner. (vlax-for entry (vla-get-Viewports doc) (vla-put-GridOn entry :vlax-true) (vla-put-ActiveViewport doc entry) (setq upperRight (vlax-safearray->list (vlax-variant-value (vla-get-UpperRightCorner entry)))) (alert (strcat "The upper right corner of this viewport is " (rtos (nth 0 upperRight) 2) ", " (rtos (nth 1 upperRight) 2))) (vla-put-GridOn entry :vlax-false) ) ) |
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-3-5 17:52
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.