Split メソッド(ActiveX)

ビューポートを、指定した数のビューに分割します。

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

構文と要素

VBA:

object.Split NumWins
object

タイプ: Viewport

このメソッドが適用されるオブジェクト。

NumWins

アクセス: 入力のみ

タイプ: AcViewportSplitType 列挙型

  • acViewport2Horizontal
  • acViewport2Vertical
  • acViewport3Above
  • acViewport3Below
  • acViewport3Horizontal
  • acViewport3Left
  • acViewport3Right
  • acViewport3Vertical
  • acViewport4

戻り値(RetVal)

戻り値はありません。

注意

Split メソッドが呼び出されても、ActiveViewport プロパティでビューポートをアクティブにしなければ、変更結果は表示されません。Split メソッドを呼び出す前にビューポートがアクティブだった場合でも、同様です。

ビューポートをアクティブにするのは、このメソッドを使用するためではなく、このメソッドの結果を表示するためです。

VBA:

Sub Example_Split()
    ' This example creates a new viewport and makes it active.
    ' Then it splits the viewport into four windows.
    ' It then takes one of the four windows, and splits that
    ' window horizontally in half.
    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 four windows
    newViewport.Split acViewport4
    
    ' Make the newly split viewport active
    ThisDrawing.ActiveViewport = newViewport
    
    ' Note that current drawing layout will show four windows.
    ' However, only one of the windows will be active.
    ' The following code sets the lower-left corner window
    ' to be the active window and then splits that
    ' window into two horizontal windows.
    Dim entry
    For Each entry In ThisDrawing.Viewports
        If entry.name = "TESTVIEWPORT" Then
            Dim lowerLeft
            lowerLeft = entry.LowerLeftCorner
            If lowerLeft(0) = 0 And lowerLeft(1) = 0 Then
                Set newViewport = entry
                Exit For
            End If
        End If
    Next
    newViewport.Split acViewport2Horizontal
    ThisDrawing.ActiveViewport = newViewport
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Split()
    ;; This example creates a new viewport and makes it active.
    ;; Then it splits the viewport into four windows.
    ;; It then takes one of the four windows, and splits that
    ;; window horizontally in half.
    (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)
    
    ;; Note that current drawing layout will show four windows.
    ;; However, only one of the windows will be active.
    ;; The following code sets the lower-left corner window
    ;; to be the active window and then splits that
    ;; window into two horizontal windows.
    (vlax-for entry (vla-get-Viewports doc)
        (if (= (vla-get-Name entry) "TESTVIEWPORT")
            (progn
                (setq lowerLeft (vlax-variant-value (vla-get-LowerLeftCorner entry)))

                (if (and (= (vlax-safearray-get-element lowerLeft 0) 0)
                         (= (vlax-safearray-get-element lowerLeft 1) 0))
                    (setq newViewport entry)
                )
            )
        )
    )

    (vla-Split newViewport acViewport2Horizontal)
    (vla-put-ActiveViewport doc newViewport)
)