CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

修改的事件 (ActiveX)

2023-1-2 23:43| 发布者: admin| 查看: 218| 评论: 0|来自: AutoCAD

摘要: 修改图形中的对象或集合时触发。

修改图形中的对象或集合时触发。

支持的平台:仅窗口

签名

工 务 局:

object.Modified(Entity)
对象

类型:所有图形对象,块,字典,暗样式,暗样式,组,,图层,图层布局布局线型线型材料MLeader样式,模型空间,图纸空间打印配置,打印配置,已注册的应用程序已注册的应用程序分区管理器,分区设置,分区类型设置排序表,表格样式,文本样式文本样式UCSUCS,视图,视口视口视图X科德

计算结果为有效容器对象的对象表达式。

实体

类型:绘图对象

图形中修改的对象可以是图形对象中的任何一个。

言论

每当修改对象时,都会触发此事件。修改包括每当设置属性的值时,即使新值等于当前值也是如此。

在 VBA 中编码时,必须为为事件启用的所有对象提供事件处理程序。如果不提供处理程序,VBA 可能会意外终止。Modified

显示模式对话框时不会触发任何事件。

例子

工 务 局:

Public WithEvents PLine As AcadLWPolyline    ' Use with Modified Event Example
Sub Example_Modified()
     ' This example creates a lightweight polyline in model space and
     ' references the PolyLine using the public variable (PLine) which
     ' is set up to intercept Modified events.
     '
     ' This example then modifies the new object, triggering the code
     ' in the Modified event.
    
    Dim points(0 To 9) As Double
    
    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1
    points(2) = 1: points(3) = 2
    points(4) = 2: points(5) = 2
    points(6) = 3: points(7) = 2
    points(8) = 4: points(9) = 4
        
    ' Create a lightweight Polyline object in model space
    '
    ' * Note: We are returning the new PolyLine object into a Module
    ' level variable.  This allows us to intercept events associated
    ' with that particular object.
    Set PLine = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    
    ThisDrawing.Application.ZoomAll
    
    ' Modify object to trigger event.
    '
    ' * Note: The event code for the PolyLine modification will be triggered
    ' before we move forward and refresh the view, so the line will not
    ' appear blue when the event message box is displayed.
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor." + Left(AcadApplication.Version, 2))
    Call color.SetRGB(80, 100, 244)
    PLine.TrueColor = color

    ThisDrawing.Regen acAllViewports
    
End Sub

Private Sub PLine_Modified(ByVal pObject As AutoCAD.IAcadObject)
    ' This example intercepts an object's Modified event.
    '
    ' This event is triggered when an object supporting this event is modified.
    '
    ' To trigger this code: Modify an object connected to this event
    ' * Note: By connected, we mean the object set up to intercept events using
    ' the VBA WithEvents statement

    ' Use the "pObject" variable to determine which object was modified
    MsgBox "You just modified an object with an ID of: " & pObject.ObjectID
    
End Sub

Visual LISP:

Not available

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 17:08

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部