在有些操作中需要在图像中加入一些文字,提示用户,提示完在删除,如何实现呢,-
-
- Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
- Dim acCurDb As Database = acDoc.Database
- Dim objId As ObjectId
- '' Start a transaction
- Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
- '' Open the Block table for read
- Dim acBlkTbl As BlockTable
- acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)
- '' Open the Block table record Model space for write
- Dim acBlkTblRec As BlockTableRecord
- acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _
- OpenMode.ForWrite)
- Dim acText As DBText = New DBText()
- acText.SetDatabaseDefaults()
- acText.Position = New Point3d(0, 0, 0)
- acText.Height = 100
- acText.TextString = "Hello!"
- acBlkTblRec.AppendEntity(acText)
- acTrans.AddNewlyCreatedDBObject(acText, True)
- '' Add the new object to the block table record and the transaction
- acText.Highlight()
- '' Update the display and display an alert message
- acDoc.Editor.Regen()
- ''在删除前显示
- acText.Erase(True)
- '' Save the new object to the database
- Application.ShowAlertDialog("Erase the newly added text.")
- acTrans.Commit()
- End Using
好像只能第一次运行时能看到文字,在运行就看不见了 奇怪了
|