明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 9291|回复: 18

怎样实现鼠标悬停时显示Xdata中的内容

  [复制链接]
发表于 2012-5-5 16:38 | 显示全部楼层 |阅读模式
我在对象(如直线)中已附加了Xdata数据,在鼠标悬停在该直线上时,想自动弹出个窗体来显示Xdata数据,请问该怎样实现,谢谢大家。
发表于 2017-12-27 18:30 | 显示全部楼层
Mark,回头看看,有没有编程实现设置
【系统的悬停提示关闭了
在选项的显示选项卡里面可以关闭】的?
发表于 2012-5-5 20:06 | 显示全部楼层
一会传你一个
发表于 2012-5-5 21:32 | 显示全部楼层
声明版权归不死猫所有

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x

点评

试了,不行啊,只是画根线出来,不能读属性啊  发表于 2012-5-9 15:46
 楼主| 发表于 2012-5-5 21:58 | 显示全部楼层
感谢回复。
抱歉,我的明币不足,请问有VB.net的示例代码吗?期待中…………
发表于 2012-5-9 12:30 | 显示全部楼层
用pointmonitor,官方教程有
发表于 2012-5-10 09:29 | 显示全部楼层
sailorcwx 发表于 2012-5-9 12:30
用pointmonitor,官方教程有

能具体说明吗?找了下没找到
 楼主| 发表于 2012-5-11 21:41 | 显示全部楼层
多谢回复

示例代码严重期待中
 楼主| 发表于 2012-5-11 23:05 | 显示全部楼层
已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
        <CommandMethod("TestOn")> _
               Public Sub MyTestOn()
            AddHandler ed.PointMonitor, New PointMonitorEventHandler(AddressOf ed_PointMonitor)
        End Sub

        <CommandMethod("TestOff")> _
        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
 楼主| 发表于 2012-5-14 22:13 | 显示全部楼层
上面的代码,我在2007中试没问题,但在2010中却显示不出来。好像
“e.AppendToolTipText(vbCrLf & "这是 :" + ent.GetType().FullName)”
这句没有发生作用,是有什么设置,还是代码有问题,请楼上赐教。多谢
发表于 2012-5-14 23:29 | 显示全部楼层
这是因为系统的悬停提示覆盖了你的悬停提示,你可以把系统的悬停提示关闭了
在选项的显示选项卡里面可以关闭
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-27 08:00 , Processed in 0.253974 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表