CAD动态提示(c++)

CAD控件具有鼠标停在一个对象上,然后自动弹出一个提示信息窗口的功能。

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;
}

posted on 2019-06-26 10:09  梦想CAD控件  阅读(409)  评论(0)    收藏  举报

导航