ynchlss 发表于 2007-8-16 22:13:00

[求助]新建图形数据库中文字居中错误

<p>我在用 new&nbsp; AcDbDatabase 创建的图形数据库中,用AcDbText创建文本标注,但设成水平中心对齐后显示位置不对,苦苦研究了两天,就是解决不了,同样的代码在打开的图形数据库则正常,请各位虾救救我吧!</p><p>以下两段代码都不行</p><p>代码1:</p><p>&nbsp;&nbsp;AcDbText *pText=new AcDbText;<br/>&nbsp;&nbsp;pText-&gt;setHorizontalMode(AcDb::kTextCenter);<br/>&nbsp;&nbsp;pText-&gt;setAlignmentPoint(PointZDH);<br/>&nbsp;&nbsp;pText-&gt;setTextString(m_szDrawZDH);<br/>&nbsp;&nbsp;pText-&gt;setTextStyle(TextStyleZDH);<br/>&nbsp;&nbsp;pText-&gt;setHeight(2.5*m_DrawScale);<br/>&nbsp;&nbsp;pText-&gt;setRotation(0.0);</p><p>&nbsp;&nbsp;AcDbObjectId textId;<br/>&nbsp;&nbsp;pBlockTableRecord-&gt;appendAcDbEntity(textId,pText);<br/>&nbsp;&nbsp;pText-&gt;adjustAlignment(m_pDb);<br/>&nbsp;&nbsp;pText-&gt;close();</p><p>代码2:<br/>&nbsp;&nbsp;AcDbText *pText=new AcDbText(PointZDH,m_szDrawZDH,TextStyleZDH,2.5*m_DrawScale);<br/>&nbsp;&nbsp;AcDbObjectId textId;<br/>&nbsp;&nbsp;pBlockTableRecord-&gt;appendAcDbEntity(textId,pText);<br/>&nbsp;&nbsp;pText-&gt;setHorizontalMode(AcDb::kTextMid);<br/>&nbsp;&nbsp;pText-&gt;setAlignmentPoint(PointZDH);<br/>&nbsp;&nbsp;pText-&gt;setColorIndex(m_DrawColor);<br/>&nbsp;&nbsp;pText-&gt;setLayer(m_LayerZJ);<br/>&nbsp;&nbsp;pText-&gt;setWidthFactor(0.8);<br/>&nbsp;&nbsp;pText-&gt;adjustAlignment(m_pDb);<br/>&nbsp;&nbsp;pText-&gt;close();</p>
页: [1]
查看完整版本: [求助]新建图形数据库中文字居中错误