- 积分
- 463
- 明经币
- 个
- 注册时间
- 2002-6-19
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2004-4-5 16:17:00
|
显示全部楼层
按照楼上的指点,写出如下的代码,可屏幕输出却是??????!,我觉得可能还是没有
没有应用中文字体,那么应该如何改呢,错误在哪?请继续指点!!!!
void settextstyle(AcDbText *pText) //参数为AcDbText *&pText也一样 { AcGePoint3d startpoint(500,500,0); AcDbTextStyleTable *pTextTbl; acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pTextTbl, AcDb::kForWrite); AcDbObjectId recId; pTextTbl->getAt("仿宋_GB2312",recId); pTextTbl->close(); pText->setTextStyle(recId); pText->setHeight(3.0); pText->setWidthFactor(0.7); pText->setPosition(startpoint); pText->setHorizontalMode(AcDb::kTextMid);//设置文本对齐方式 pText->setTextString("这是一个测试!"); }
void drawtext() { AcDbText* ptextout=new AcDbText(); settextstyle(ptextout); AcDbBlockTable *pblocktable; acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pblocktable,AcDb::kForWrite); AcDbBlockTableRecord *pblockrecord; pblocktable->getAt(ACDB_MODEL_SPACE,pblockrecord,AcDb::kForWrite); pblocktable->close(); AcDbObjectId id; pblockrecord->appendAcDbEntity(id,ptextout); pblockrecord->close(); ptextout->close(); } |
|