浪漫如枫 发表于 2006-12-2 01:45:00

[ARX][求助]关于acdbText

请问如何得到acdbText的具体宽度?谢谢~~

松竹 发表于 2006-12-4 12:59:00

<P>//获得TEXT文本的实际宽度<BR>double GetTextTrueWidth(CString sText, double dTextHeight, CString sTextStyle)<BR>{<BR>&nbsp;AcGiTextStyle TextStyle;<BR>&nbsp;if(!sTextStyle.IsEmpty())<BR>&nbsp;{<BR>&nbsp;&nbsp;if(fromAcDbTextStyle(TextStyle, LPCTSTR(sTextStyle)) != Acad::eOk)&nbsp;return 0.0;<BR>&nbsp;}<BR>&nbsp;else<BR>&nbsp;{<BR>&nbsp;&nbsp;if(fromAcDbTextStyle(TextStyle, acdbHostApplicationServices()-&gt;workingDatabase()-&gt;textstyle()) != Acad::eOk) <BR>&nbsp;&nbsp;&nbsp;return 0.0;<BR>&nbsp;}<BR>&nbsp;TextStyle.setTextSize(dTextHeight);<BR>&nbsp;TextStyle.loadStyleRec();<BR>&nbsp;AcGePoint2d Pt = TextStyle.extents(LPCTSTR(sText), Adesk::kTrue, -1, Adesk::kFalse);</P>
<P>&nbsp;return Pt.x;<BR>}<BR></P>

chenknight 发表于 2006-12-13 21:02:00

使用AcDbEntity::getGeomExtents 函数可以得到物件的在下和右上点<br/>
页: [1]
查看完整版本: [ARX][求助]关于acdbText