Visible 属性 (ActiveX)
指定对象或应用程序的可见性。 支持的平台:仅限 Windows 属性值只读:否(只写对象除外)Group 类型:布尔
言论如果将对象指定为不可见对象,则无论应用程序可见设置如何,该对象都将不可见。其他因素也可能导致物体不可见;例如,如果对象的图层处于关闭状态或冻结状态,则不会显示该对象。 将应用程序指定为不可见,允许您在后台运行任务,而无需查看组件。 例子VBA: Sub Example_Visible()
' This example creates a line in model space.
' It then turns visibility of the line on or off, depending
' on the user's choice.
Dim lineObj As AcadLine
Dim startPoint(0 To 2) As Double
Dim endPoint(0 To 2) As Double
' Create the line
startPoint(0) = 2#: startPoint(1) = 2#: startPoint(2) = 0#
endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
ZoomAll
Dim response As Integer
response = MsgBox("Do you want the new line to be visible?", vbYesNoCancel + vbQuestion)
Select Case response
Case vbYes
lineObj.Visible = True
Case vbNo
lineObj.Visible = False
Case vbCancel
Exit Sub
End Select
ThisDrawing.Regen True
End Sub
可视化 LISP: (vl-load-com)
(defun c:Example_Visible()
;; This example creates a line in model space.
;; It then turns visibility of the line on or off, depending
;; on the user's choice.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Create the line
(setq startPoint (vlax-3d-point 2 2 0)
endPoint (vlax-3d-point 4 4 0))
(setq modelSpace (vla-get-ModelSpace doc))
(setq lineObj (vla-AddLine modelSpace startPoint endPoint))
(vla-ZoomAll acadObj)
(setq kwordList "Yes No")
(vla-InitializeUserInput (vla-get-Utility doc) 1 kwordList)
(setq response (vla-GetKeyword (vla-get-Utility doc) "Do you want the new line to be visible? [Yes/No]: "))
(cond
((= response "Yes") (vla-put-Visible lineObj :vlax-true))
((= response "No") (vla-put-Visible lineObj :vlax-false))
)
(vla-Regen doc :vlax-true)
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-11-1 08:30
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.