เพิ่มรายการ TEXT/MTEXT ใหม่
Contents
[
Hide
]วิธีการเพิ่มรายการ TEXT/MTEXT ใหม่
ปัญหา: วิธีการเพิ่มรายการ TEXT/MTEXT ใหม่
เคล็ดลับ: สำหรับสิ่งนี้คุณสามารถใช้คุณสมบัติ BlockEntities["*Model_Space"] และ AddEntity เพื่อเพิ่มเอนทิตีใหม่ไปยังการวาด และอย่าลืมวิธี UpdateSize เพื่ออัปเดตขนาด
ตัวอย่าง:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |