CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

ImageVisibility Property (ActiveX)

2023-1-3 14:33| 发布者: admin| 查看: 402| 评论: 0|来自: AutoCAD

摘要: 指定图像可见性是打开还是关闭。

指定图像可见性是打开还是关闭。

支持的平台:仅窗口

签名

工 务 局:

object.ImageVisibility
对象

类型:地理地图图像,栅格图像擦除

此属性适用的对象。

属性值

只读:

类型:布尔

  • True:图像可见。
  • False:图像已隐藏。

言论

可以通过在当前绘图会话中不需要图像可见性时关闭图像可见性来提高重绘速度。不显示或绘制隐藏的图像;仅显示绘图边界。您可以选择隐藏图像,而不考虑当前视口坐标系,或者特别是当图像与当前视口坐标系不正交(对齐)时。

例子

工 务 局:

Sub Example_ImageVisibility()
    ' This example inserts a raster image and finds the current status
    ' of ImageVisibility for the image. It then changes the ImageVisibility
    ' status of the image.
    
    ' This example uses the "2d Projected Polylines.jpg" found in the Sample
    ' directory. If you do not have the image, or if it is located
    ' in a different directory, insert a valid path and name for the
    ' imageName variable below.
    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotAngleInDegree As Double, rotAngle As Double
    Dim imageName As String
    Dim raster As AcadRasterImage
    imageName = "C:\AutoCAD\sample\2d Projected Polylines.jpg"
    insertionPoint(0) = 2#: insertionPoint(1) = 2#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotAngleInDegree = 0#
    rotAngle = rotAngleInDegree * 3.141592 / 180#
    
    On Error Resume Next
    
    ' Creates a raster image in model space
    Set raster = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotAngle)
    If Err.Description = "File error" Then
        MsgBox imageName & " could not be found."
        Exit Sub
    End If

    ' Find the current ImageVisibility
    ThisDrawing.Regen True
    MsgBox "The ImageVisibility is currently set to: " & raster.ImageVisibility, vbInformation
    
    ' Change the ImageVisibility
    If (raster.ImageVisibility) Then
        raster.ImageVisibility = False
    Else
        raster.ImageVisibility = True
    End If
    ThisDrawing.Regen True
    MsgBox "The ImageVisibility is now set to: " & raster.ImageVisibility, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ImageVisibility()
    ;; This example inserts a raster image and finds the current status
    ;; of ImageVisibility for the image. It then changes the ImageVisibility
    ;; status of the image.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; This example uses the "2d Projected Polylines.jpg" found in the Sample
    ;; directory. If you do not have the image, or if it is located
    ;; in a different directory, insert a valid path and name for the
    ;; imageName variable below.
    (setq insertionPoint (vlax-3d-point 2 2 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotAngle (/ (* 0 3.141592 180)))
    
    ;; Creates a raster image in model space
    (if (/= (findfile imageName) nil)
        (progn
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq raster (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotAngle))
	    
	           ;; Find the current ImageVisibility
	           (vla-Regen doc :vlax-true)
	           (alert (strcat "The ImageVisibility is currently set to: " (if (= (vla-get-ImageVisibility raster) :vlax-true) "True" "False")))
	    
	           ;; Change the ImageVisibility
	           (if (= (vla-get-ImageVisibility raster) :vlax-true)
	               (vla-put-ImageVisibility raster :vlax-false)
	               (vla-put-ImageVisibility raster :vlax-true)
	           )
	           (vla-Regen doc :vlax-true)
	           (alert (strcat "The ImageVisibility is now set to: " (if (= (vla-get-ImageVisibility raster) :vlax-true) "True" "False")))
        )
        (alert (strcat imageName " could not be found."))
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-19 13:51

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部