CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

视口属性 (ActiveX)

2023-1-3 01:32| 发布者: admin| 查看: 202| 评论: 0|来自: AutoCAD

摘要: 指定视区的显示状态。

指定视区的显示状态。

支持的平台:仅窗口

签名

工 务 局:

object.ViewportOn
对象

类型:光伏港

此属性适用的对象。

属性值

只读:

类型:布尔

  • True:视口已打开。
  • False:视口已关闭。

言论

若要打开或关闭视区的显示控件,请使用该方法。Display

例子

工 务 局:

Sub Example_ViewportOn()
    ' This example creates two new paper space viewports.
    ' It then checks the status of the viewports.
    
    Dim pviewportObj1 As AcadPViewport
    Dim pviewportObj2 As AcadPViewport
    Dim center(0 To 2) As Double
    Dim width As Double
    Dim height As Double
    
    ' Define the paper space viewport
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 10
    height = 10
    
    ' Change from model space to paper space
    ThisDrawing.ActiveSpace = acPaperSpace
    
    ' Create the paper space viewports
    Set pviewportObj1 = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
    center(0) = 8: center(1) = 8: center(2) = 0
    width = 10
    height = 10
    Set pviewportObj2 = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
    
    ' Before making a paper space viewport active,
    ' the mspace property needs to be True
    pviewportObj1.DISPLAY (True)
    ThisDrawing.mspace = True
    ThisDrawing.ActivePViewport = pviewportObj1
    ThisDrawing.Regen acAllViewports
    
    MsgBox "pviewportObj1 is " & (IIf(pviewportObj1.ViewportOn, "on.", "not on.")) & vbCrLf & _
           "pviewportObj2 is " & (IIf(pviewportObj2.ViewportOn, "on.", "not on."))
    
    ' Now turn on pviewportObj2 as well
    pviewportObj2.DISPLAY (True)
    MsgBox "pviewportObj1 is " & (IIf(pviewportObj1.ViewportOn, "on.", "not on.")) & vbCrLf & _
           "pviewportObj2 is " & (IIf(pviewportObj2.ViewportOn, "on.", "not on."))
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ViewportOn()
    ;; This example creates two new paper space viewports.
    ;; It then checks the status of the viewports.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 10
          height 10)
    
    ;; Change from model space to paper space
    (vla-put-ActiveSpace doc acPaperSpace)
    
    ;; Create the paper space viewports
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq pviewportObj1 (vla-AddPViewport paperSpace center width height))
  
    (setq center (vlax-3d-point 8 8 0)
          width 10
          height 10)

    (setq pviewportObj2 (vla-AddPViewport paperSpace center width height))
    
    ;; Before making a paper space viewport active,
    ;; the mspace property needs to be True
    (vla-Display pviewportObj1 :vlax-true)

    (vla-put-MSpace doc :vlax-true)
    (vla-put-ActivePViewport doc pviewportObj1)
    (vla-Regen doc acAllViewports)
    
    (alert (strcat "pviewportObj1 is " (if (= (vla-get-ViewportOn pviewportObj1) :vlax-true) "on." "not on.")
                   "\npviewportObj2 is " (if (= (vla-get-ViewportOn pviewportObj2) :vlax-true) "on." "not on.")))
    
    ;; Now turn on pviewportObj2 as well
    (vla-Display pviewportObj2 :vlax-true)

    (alert (strcat "pviewportObj1 is " (if (= (vla-get-ViewportOn pviewportObj1) :vlax-true) "on." "not on.")
                   "\npviewportObj2 is " (if (= (vla-get-ViewportOn pviewportObj2) :vlax-true) "on." "not on.")))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-12 07:30

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部