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