查看单个帖子
旧 2009-04-20, 12:31 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】vb.net tooltip 可能存在点小问题

vb.net tooltip 可能存在点小问题
www.dimcax.com
vb.net tooltip 可能存在点小问题
option strict on
imports autodesk.autocad.applicationservices
imports autodesk.autocad.databaseservices
imports autodesk.autocad.editorinput
imports autodesk.autocad.runtime
namespace 动态取得对象
public class class1
dim db as database = hostapplicationservices.workingdatabase
dim ed as editor = application.documentmanager.mdiactivedocument.editor
dim entname as string '对象名称
<commandmethod("test")> _
public sub test()
addhandler ed.rollover, addressof getentityfrommouse
addhandler ed.pointfilter, addressof settooltip
end sub
'设置tooltip
private sub settooltip(byval sender as object, byval e as pointfiltereventargs)
if entname = nothing then
e.result.tooltiptext = entname
else
e.result.tooltiptext = "当前对象是:" + entname
end if
end sub
'通过鼠标动态获取对象
private sub getentityfrommouse(byval sender as object, byval e as rollovereventargs)
entname = nothing
dim entids() as objectid = e.highlighted.getobjectids()
if entids.getlength(0) > 0 then
using trans as transaction = db.transactionmanager.starttransaction()
dim ent as entity = ctype(trans.getobject(entids(0), openmode.forread, false), entity) '.getxdata(appname)
entname = ent.getrxclass.name
ed.writemessage(vblf + "当前对象是:" + entname + vblf)
trans.commit()
end using
end if
end sub
end class
end namespace
问题呢?
c#最适合开发autocad,因为它拥有vb容易的特点,却具有vc++的强大功能。
鼠标首次移动到对象,有时显示系统tooltip。
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)