上面提到的几种方法你没有说什么语言,所以我会提供 VB.Net首先你需要捕获文档集合。要利用现有事件,只需像这样声明变量 WithEvents(公共或私有,视情况而定)您需要将其设置为类中的全局变量 Private WithEvents docManager = Autodesk.AutoCAD.ApplicationServices.DocumentCollection现在您可以捕获这样的文档事件:Private Sub docManager_DocumentActivated(sender as Object, e As DocumentCollectionEventArgs) Handles docManager.DocumentActivated。
'DoStuffHere。
结束子。
。
Private Sub docManager_DocumentCreated(sender as Object, e As DocumentCollectionEventArgs) Handles docManager.DocumentCreated。
'DoStuffHere。
结束子。