UpperRightCorner プロパティ(ActiveX)

現在アクティブなビューポートの右上コーナーを取得します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.UpperRightCorner
object

タイプ: Viewport

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: はい

タイプ: バリアント型(倍精度実数の 2 要素配列)

現在アクティブなビューポートの右上コーナーを示す 2D 座標

注意

LowerLeftCorner プロパティと UpperRightCorner プロパティは、画面上でビューポートのグラフィックスの位置を示します。これらのプロパティは次のように定義されます。



ビューポート 1-LowerLeftCorner = (0, .5), UpperRightCorner = (.5, 1)

ビューポート 2 -LowerLeftCorner = (.5, .5), UpperRightCorner = (1, 1)

ビューポート 3-LowerLeftCorner = (0, 0), UpperRightCorner = (.5, .5)

ビューポート 4-LowerLeftCorner = (.5, 0), UpperRightCorner = (1, .5)

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

Visual 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)
    )
)