返回多行文字,的文字内容。
[id(184), helpstring("method GetMTextContent")]
BSTR GetMTextContent(LONGLONG lId);例如: 实现代码
BSTR CMxDrawXCtrl::GetMTextContent(LONGLONG lId)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CString strResult;
McDbObjectId id;
id.setFromOldId(lId);
McDbObjectPointer<McDbMText> spMText(id,McDb::kForRead);
if(spMText.openStatus() != Mcad::eOk)
return strResult.AllocSysString();
McDbVoidPtrArray entitySet;
spMText->explode(entitySet);
for(int i = 0; i < entitySet.length();i++)
{
McDbObject* pObj = (McDbObject*)entitySet[i];
if(pObj== NULL)
{
MXASSERT(0);
continue;
}
McDbText* pText = McDbText::cast(pObj);
if(pText != NULL)
{
CString sVal = pText->textStringConst();
if(strResult.IsEmpty())
{
strResult = sVal;
}
else
{
CString sTmp;
sTmp.Format(_T("%s%s"),strResult,sVal);
strResult = sTmp;
}
}
delete pObj;
}
return strResult.AllocSysString();
}