- UID
- 76071
- 积分
- 1505
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-8-30
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
原理,在VBA的窗体激活事件中改变USERS系统变量,VB.Net接收该事件将文档级事件处理激活到当前文档
总觉得不太妥当,有好点的办法麽?
VB.Net - Module mTlsCad代码
Private WithEvents pACadApp As AcadApplication = Application.AcadApplication
Private WithEvents pACadDoc As AcadDocument = pACadApp.ActiveDocument
Private Sub pACadApp_SysVarChanged(ByVal SysvarName As String, ByVal newVal As Object) Handles pACadApp.SysVarChanged
If SysvarName.ToUpper = "*USERS5" Then pACadDoc = pACadApp.ActiveDocument
End Sub
Private Sub pACadDoc_BeginDoubleClick(ByVal PickPoint As Object) Handles pACadDoc.BeginDoubleClick
Dim ss As AcadSelectionSet
ss = pACadDoc.PickfirstSelectionSet
If ss.Count = 0 Then
Exit Sub
ElseIf ss.Count = 1 Then
Select Case ss.Item(0).EntityName
Case "AcDbBlockReference"
If ss.Item(0).HasAttributes Then
pACadDoc.SendCommand("_.eattedit" & vbCr & vbCr & vbCr)
End If
Case "AcDbText", "AcDbMText"
pACadDoc.SendCommand("_.ddedit" & vbCr & vbCr)
Case Else
pACadDoc.SendCommand("_.properties" & vbCr)
End Select
Else
pACadDoc.SendCommand("_.properties" & vbCr)
End If
End Sub
VBA - ThisDrawing代码
Private Sub AcadDocument_Activate()
Dim pUser As String
pUser = ThisDrawing.GetVariable("USERS5")
ThisDrawing.SetVariable "USERS5", str(Now)
ThisDrawing.SetVariable "USERS5", pUser
End Sub |
|