输入点管理器,用于监视鼠标等用户输入事件,调用MxDraw::GetDatabase(m_hDrawOcx)->GetDocument()->inputPointManager() 返回管理器对象
class McEdInputPointManager;
mcedinpt.h
例如:sampleeditedit.sln中的例子,实现鼠标放到实体上动态提示信息
class CInputPointMonitor : public McEdInputPointMonitor { public: virtual ~CInputPointMonitor(void); static void AddPointMonitor(McEdInputPointManager* pInputManager); static void RemovePointMonitor(McEdInputPointManager* pInputManager); protected: CInputPointMonitor(void); virtual Mcad::ErrorStatus MonitorInputPointToolTip(IN const McDbObjectIdArray& pickedEntities, IN const McGePoint3d& pickedPoint, IN CString& sNewToolTipString ); private: static CInputPointMonitor s_inputPointMonitor; }; CInputPointMonitor CInputPointMonitor::s_inputPointMonitor; CInputPointMonitor::CInputPointMonitor(void) { } CInputPointMonitor::~CInputPointMonitor(void) { } void CInputPointMonitor::AddPointMonitor(McEdInputPointManager* pInputManager) { pInputManager->addPointMonitor(&s_inputPointMonitor); } void CInputPointMonitor::RemovePointMonitor(McEdInputPointManager* pInputManager) { pInputManager->removePointMonitor(&s_inputPointMonitor); } 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; } // 注册反应器 CInputPointMonitor::AddPointMonitor(MxDraw::GetDatabase(m_hDrawOcx)->GetDocument()->inputPointManager());