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。