一个画图问题
请问各位高手如何能实现让图形跟着鼠标走,鼠标点击时获取鼠标点击的坐标然后把图型移动到那个坐标? <p>问题已解决!使用acedGrRead()就可以循环跟踪鼠标动作啦</p><p>实现代码片断如下:</p><p> AcDbBlockReference *pBlkRef = new AcDbBlockReference() ;<br/> pBlkRef->setBlockTableRecord(idNewBlock) ;<br/> AcGePoint3d pntRefPos(0.0,0.0,0.0) ;<br/> <br/> AcDbBlockTable *pCurBlkTab ;<br/> AcDbBlockTableRecord *pCurBlkTabRcd ;<br/> pCurDatabase->getBlockTable(pCurBlkTab,AcDb::kForRead) ;<br/> pCurBlkTab->getAt(ACDB_MODEL_SPACE,pCurBlkTabRcd,AcDb::kForWrite) ;<br/> pCurBlkTab->close() ;</p><p> AcDbObjectId idBlkRef ;<br/> pCurBlkTabRcd->appendAcDbEntity(idBlkRef,pBlkRef) ;<br/> pBlkRef->close() ;</p><p> resbuf res ;<br/> int type ;<br/> do<br/> {<br/> acedGrRead(1,&type,&res) ;<br/> pntRefPos = res.resval.rpoint ;<br/> pntRefPos = res.resval.rpoint ;</p><p> acdbOpenObject(pBlkRef,idBlkRef,AcDb::kForWrite) ;<br/> pBlkRef->setPosition(pntRefPos) ;<br/> pBlkRef->close() ;<br/> }<br/> while (type != 3) ;</p> <p>这个问题能给完整的答案和解释吗?</p><p>谢谢!</p>
页:
[1]