DeleteConfiguration メソッド(ActiveX)

ビューポート設定を削除します。

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

構文と要素

VBA:

object.DeleteConfiguration Name
object

タイプ: Viewports

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

Name

アクセス: 入力のみ

タイプ: 文字列

削除するビューポート設定の名前。

戻り値(RetVal)

戻り値はありません。

注意

ビューポート設定は、Split メソッドによって分割された単一のビューポートから成っています。ビューポートが分割されると、分割されたそれぞれのビューポートは一つのビューポート設定とみなされます。設定内のすべてのビューポートは、分割前の元のビューポートと同じ名前を持ちます。

VBA:

Sub Example_DeleteConfiguration()
    ' This example creates a new viewport and splits
    ' the viewport into 4 windows.
    ' It then deletes the viewport configuration
    Dim oldViewport As AcadViewport
    Set oldViewport = ThisDrawing.ActiveViewport
       
    ' Create a new viewport and make it active
    Dim newViewport As AcadViewport
    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
    MsgBox "The viewport configuration split into 4 windows."

    ' Delete the viewport configuration
    ThisDrawing.ActiveViewport = oldViewport
    ThisDrawing.Viewports.DeleteConfiguration ("TESTVIEWPORT")
    ThisDrawing.Regen acAllViewports
    MsgBox "The viewport configuration has been deleted."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DeleteConfiguration()
    ;; This example creates a new viewport and splits
    ;; the viewport into 4 windows.
    ;; It then deletes the viewport configuration
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq oldViewport (vla-Add (vla-get-Viewports doc) "CurrentViewport"))
       
    ;; Create a new viewport and make it active
    (setq newViewport (vla-Add (vla-get-Viewports doc) "NewViewport"))
    (vla-put-ActiveViewport doc newViewport)
    
    ;; Split the viewport in 4 windows
    (vla-Split newViewport acViewport4)
    
    ;; Make the newly split viewport active
    (vla-put-ActiveViewport doc newViewport)
    (alert "The viewport configuration split into 4 windows.")

    ;; Delete the viewport configuration
    (vla-put-ActiveViewport doc oldViewport)
    (vla-DeleteConfiguration (vla-get-Viewports doc) "NewViewport")
    (vla-DeleteConfiguration (vla-get-Viewports doc) "CurrentViewport")
    (vla-Regen doc acAllViewports)
    (alert "The viewport configurations have been deleted and original viewport restored.")
)