|
发表于 2012-5-11 23:05:00
|
显示全部楼层
已OK了
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.GeomeTry
Imports Autodesk.AutoCAD.Runtime
Namespace tooltip
Public Class Class1
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
_
Public Sub MyTestOn()
AddHandler ed.PointMonitor, New PointMonitorEventHandler(AddressOf ed_PointMonitor)
End Sub
_
Public Sub MyTestOff()
RemoveHandler ed.PointMonitor, New PointMonitorEventHandler(AddressOf ed_PointMonitor)
End Sub
Private Sub ed_PointMonitor(ByVal sender As Object, ByVal e As PointMonitorEventArgs)
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim ipc As InputPointContext = e.Context
Dim ePaths() As FullSubentityPath = ipc.GetPickedEntities()
If ePaths.Length > 0 Then
Dim ePath As FullSubentityPath = ePaths(0)
Dim trans As Transaction = db.TransactionManager.StartTransaction()
Dim entId As ObjectId = ePath.GetObjectIds()(0)
Dim ent As Entity = CType(trans.GetObject(entId, OpenMode.ForRead), Entity)
e.AppendToolTipText(vbCrLf & "这是 :" + ent.GetType().FullName)
trans.Commit()
End If
End Sub
End Class
End Namespace |
|