添加新的 TEXT/MTEXT 项

如何添加新的 TEXT/MTEXT 项

问题: 如何添加新的 TEXT/MTEXT 项。

提示: 为此,您可以使用属性 BlockEntities["*Model_Space"] 和 AddEntity 将新实体添加到图形中,并且不要忘记 UpdateSize 方法来更新尺寸。

示例:

using CadImage cadImage = (CadImage)Image.Load(fileName);
CadText text = new CadText();
text.DefaultValue = "Watermark text";
text.TextHeight = 40;
text.FirstAlignment = new Cad3DPoint(300, 40);
text.LayerName = "0";
cadImage.BlockEntities["*Model_Space"].AddEntity(text);
CadMText watermark = new CadMText();
watermark.Text = "Watermark message";
watermark.InitialTextHeight = 40;
watermark.InsertionPoint = new Cad3DPoint(300, 40);
watermark.LayerName = "0";
cadImage.BlockEntities["*Model_Space"].AddEntity(watermark);
cadImage.UpdateSize();