调用文字在位编辑器

示例为修改多行文字的高宽比

public static    void ChangeMtextWidthFactor(ObjectId mtextId,double widthFactor)
        {
            if(mtextId==null ||mtextId==ObjectId.Null)
                return ;
            using (Transaction trx = ZMQCad.ApplicationServicesEx.Var.ActiveDatabase.TransactionManager.StartTransaction())
            {
                MText mt = trx.GetObject(mtextId, OpenMode.ForWrite) as MText;
                using (TextEditor te = InplaceTextEditor.CreateTextEditor(mt))
                {
                    te.SelectAll();
                    te.Selection.WidthScale = widthFactor;
                    te.Close(TextEditor.ExitStatus.ExitSave);
                }
                trx.Commit();
            }
        }

 

posted @ 2014-02-20 13:07  Cad人生  阅读(827)  评论(0编辑  收藏  举报