首页 > 其他 > 详细

CAD动态提示

时间:2019-07-11 16:32:22      阅读:207      评论:0      收藏:0      [点我收藏+]

控件具有鼠标停在一个对象上,然后自动弹出一个提示信息窗口的功能。参考例子:samples\ie\iedemoTest.htm,点击例子上边的设置超连接按钮,然后把鼠标停在对象上两秒,就能看到效果了。自动提示事件,用户响应该事件,返回需要显示的字符串,返回的字符串支持Html格式化。


COM接口 _DMxDrawXEvents::InputPointToolTipEvent
设置提示时间 _DMxDrawX::SetToolTipInitialTime
设置ToolTip自动提示隐藏时间 _DMxDrawX::SetToolTipPopTime


JS例子说明:


1.  增加InputPointToolTipEvent事件响应函数:


document.getElementById("MxDrawXCtrl").ImpInputPointToolTipFun = DoInputPointToolTipFun;


2.  在事件中返回需要提示的字符串:


function DoInputPointToolTipFun(ent) {
    var sHyperlinks = ent.Hyperlinks;
if(sHyperlinks.length != 0)
{
var sClassName = ent.ObjectName;
 
        var tip = "<b><ct=0x0000FF><al_c>"+sClassName+
           "</b><br><ct=0x00AA00><hr=100%></ct><br><a=\"link\">" + sHyperlinks + "</a>";
 
        mxOcx.SetEventRetString(tip);
    }
    ent = null;
    CollectGarbage();
}


C++接口 McEdInputPointMonitor::MonitorInputPointToolTip
设置提示时间 MxDraw::SetDynToolTipInitialTime
设置ToolTip自动提示隐藏时间 MxDraw::SetDynToolTipPopTime


McEdInputPointMonitor::MonitorInputPointToolTip方法


接口:


virtual Mcad::ErrorStatus MonitorInputPointToolTip(IN const McDbObjectIdArray& pickedEntities, IN const McGePoint3d& pickedPoint, IN CString& sNewToolTipString);


参数:


参数 说明
IN const McDbObjectIdArray& pickedEntities

当前光标下面的实体

IN const McGePoint3d& pickedPoint

光标位置

IN CString& sNewToolTipString  

返回提示信息字符串  


参考例子:MxDraw5.2\samples\Edit\Edit.sln中InputPointMonitor.cpp文件。代码如下:


Mcad::ErrorStatus CInputPointMonitor::MonitorInputPointToolTip(IN const McDbObjectIdArray& pickedEntities,
   IN const McGePoint3d& pickedPoint,
   IN CString& sNewToolTipString
   )
{
if(!pickedEntities.isEmpty())
{
AcDbObjectId entId = pickedEntities[0];
AcDbObjectPointer<AcDbEntity> spEnt(entId,AcDb::kForRead);
if(spEnt.openStatus() == Acad::eOk)
{
CString sClassName = spEnt->isA()->name();
 
AcDbHandle handle;
spEnt->getAcDbHandle(handle);
TCHAR szHandle[256];
handle.getIntoAsciiBuffer(szHandle);
 
CString sLayerName;
{
AcDbObjectPointer<AcDbLayerTableRecord> spLayerTableRec(spEnt->layerId(),AcDb::kForRead);
if(spLayerTableRec.openStatus() == Acad::eOk)
{
LPCTSTR pszLayerName = NULL;
spLayerTableRec->getName(pszLayerName);
sLayerName = pszLayerName;
}
}
 
sNewToolTipString.Format(_T("类名:%s,层名:%s,名柄:%s"),sClassName,sLayerName,szHandle);
}
}
return Mcad::eOk;
}

CAD动态提示

原文:https://www.cnblogs.com/yzy0224/p/11170818.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!