ObjectARX 实体双击之消息截获

作者: admin 分类: C++,CAD,ObjectARX 发布时间: 2022-05-03 22:27

https://www.cnblogs.com/edata/p/15801460.html

高版本的双击参杂了cui自定义双击处理,继承AcDbDoubleClickEdit的双击协议可能无效,因此可以尝试从消息处理

代码

bool filterMouse(MSG *pMsg)

{

if( pMsg->message == WM_LBUTTONDBLCLK )

{

ads_name ss;

if(RTNORM != acedSSGet(_T("I"),NULL,NULL,NULL,ss))

{

return false;

}

ads_name ent;

acedSSName(ss,0,ent);

acedSSFree(ss);

AcDbObjectId objId;

acdbGetObjectId(objId,ent);

CString strDxf= objId.objectClass()->dxfName();

if (strDxf == _T("MTEXT"))

{

//acutPrintf(_T("\n自定义处理"));

bool bIsMtext=false;

acDocManager->lockDocument(curDoc());

AcDbObjectPointer<AcDbMText>pMtext(objId,AcDb::kForRead);

if(Acad::eOk == pMtext.openStatus())

{

if (pMtext->colorIndex() == 1)

{

bIsMtext=true;

pMtext->close();

}

}

acDocManager->unlockDocument(curDoc());

if (bIsMtext)

{

acDocManager->sendStringToExecute(curDoc(),_T("_properties "));

//截断消息

return true;

}

}

}

//消息继续传递

return false;

}

注册

acedRegisterFilterWinMsg(filterMouse);

卸载

acedRemoveFilterWinMsg(filterMouse);

1157760-20220114131313044-1865530446.png

发表评论

您的电子邮箱地址不会被公开。

标签云