设置ToolTip自动提示时间
static void SetDynToolTipInitialTime(IN MXDRAWOCXHANDLE hOcx, IN unsigned int uiTime);
参数 |
说明 |
IN MXDRAWOCXHANDLE hOcx |
控件句柄 |
IN unsigned int uiTime |
单位是毫秒 |
控件支持鼠标放到实体上后,过uiTime时间,出来一个动态提示条,显示相关实体信息 例如: sampleedit.sln中的对动态提示条功能使用例程,参考CInputPointMonitor类的实现
在对话初始化函数里,注册事件反应器 CInputPointMonitor::AddPointMonitor(MxDraw::GetDatabase(m_hDrawOcx)->GetDocument()->inputPointManager()); //... // 在对话框销毁时,返注销事件反应器 void CTestDlg::OnDestroy() { // 注消鼠标事件反应器 CInputPointMonitor::RemovePointMonitor(MxDraw::GetDatabase(m_hDrawOcx)->GetDocument()->inputPointManager()); // ... } // 在反应器里处理动态提示事件,显示实体信息 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; }