c#中如何插入多行文本?谢谢
我想实现cad多行文本的功能,指定多行文本顶端和末端的位置,然后设置字体大小,对齐方式.然后输入要显示的字,高手们这个能指点一下,吗?帮点小忙吧,小弟在次谢过了! C++的话,AcDbMText,至于C#找一下SDK对应的类,new出来,设置一下参数,加入数据库就行了,应该不难。 谢谢我知道了Database db = Application.DocumentManager.MdiActiveDocument.Database;
DBTransMan tm = db.TransactionManager;
MText txt = new MText();
txt.Contents = "123\r\n456\r\n测试";
using(Transaction ta = tm.StartTransaction())
{
BlockTable bt = (BlockTable)tm.GetObject(db.BlockTableId, OpenMode.ForRead);
ObjectId objid;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
if (bt.Has("A010001"))
{
objid = bt["A010001"];
BlockTableRecord btr = (BlockTableRecord)tm.GetObject(objid, OpenMode.ForWrite);
btr.AppendEntity(txt);
tm.AddNewlyCreatedDBObject(txt, true);
ed.WriteMessage(btr.Name + " --- Renaud");
ta.Commit();
}
else
{
ed.WriteMessage("Not Has --- Renaud");
}
}
页:
[1]