CAD動態提示

控件具備鼠標停在一個對象上,而後自動彈出一個提示信息窗口的功能。參考例子:samples\ie\iedemoTest.htm,點擊例子上邊的設置超鏈接按鈕,而後把鼠標停在對象上兩秒,就能看到效果了。自動提示事件,用戶響應該事件,返回須要顯示的字符串,返回的字符串支持Html格式化。函數


COM接口 _DMxDrawXEvents::InputPointToolTipEvent
設置提示時間 _DMxDrawX::SetToolTipInitialTime
設置ToolTip自動提示隱藏時間 _DMxDrawX::SetToolTipPopTime


JS例子說明: spa


1.  增長InputPointToolTipEvent事件響應函數: 3d


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


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


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方法 htm


接口: 對象


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


參數: 接口


參數 說明
IN const McDbObjectIdArray& pickedEntities

當前光標下面的實體 事件

IN const McGePoint3d& pickedPoint

光標位置 ip

IN CString& sNewToolTipString  

返回提示信息字符串   ci


參考例子: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;
}
相關文章
相關標籤/搜索