freshriver 发表于 2003-7-16 17:20:00

各位看看为什么?

下面是偶写的一个写字符串的函数,我已经在别的地方设置了字体样式的高宽比为0.75,当我用下面的函数时高宽比却仍然是1,怎么回事?
不会是还要调用一个setXXXXX的函数吧?
void db_text(const char *style, ads_point sp, ads_real higher,
                       ads_real text_alf, const char *text, AcCmColor ec,
                       ads_name *tn)
{
        AcGePoint3d ip(sp, sp, sp);                  // 插入点
        AcDbObjectId tid;                                     // 字体样式ID
        AcDbTextStyleTable *pTST;
        acdbCurDwg()->getTextStyleTable(pTST, AcDb::kForRead);
        pTST->getAt(style, tid);                              // 取得字体样式ID
        pTST->close();

        AcDbText *pText = new AcDbText();
        pText->setPosition(ip);                  // 插入点
        pText->setHeight(higher);                // 字高
        pText->setRotation(text_alf);            // 旋转角
        pText->setTextString(text);            // 文字内容
        pText->setColor(ec);                     // 颜色
        pText->setTextStyle(tid);                // 样式       

        AcDbObjectId textId = AddObjectToDWG(pText);   // 添加到图形
        acdbGetAdsName(*tn, textId);                   // 返回文字的名称
        pText->close();                        // 释放指针   
}

中国虫 发表于 2003-7-17 10:13:00

liron 发表于 2003-7-18 10:29:00

须先setTextStyle(...)
页: [1]
查看完整版本: 各位看看为什么?