更新文档窗口中的几何图形
 
 

Many of the actions you perform through the AutoCAD .NET API modify what is displayed in the drawing area. Not all of these actions immediately update the display of the drawing. This is designed so you can make several changes to the drawing without waiting for the display to be updated after every single action. Instead, you can bundle your actions together and make a single call to update the display when you have finished.

通过 AutoCAD .NET API 执行的许多操作都会修改 AutoCAD 图形中显示的内容。但并不是所有这些操作都会立即更新图形的显示。这样设计的目的是使用户可以进行多次图形更改,而无需在每次更改后都等待显示更新。相反,用户可以将更改操作捆绑在一起进行,并仅在完成时进行一次调用以更新显示。

The methods that will update the display are UpdateScreen (Application and Editor objects) and Regen (Editor object).

更新显示的方法有 UpdateScreen (Application 和 Editor 对象) 和 Regen (Editor 对象)。

The UpdateScreen method redraws the application or document windows. The Regen method regenerates the graphical objects in the drawing window, and recomputes the screen coordinates and view resolution for all objects. It also re-indexes the drawing database for optimum display and object selection performance.

UpdateScreen 方法重画应用程序和文档窗口。Regen 方法将重生成图形窗口中的图形对象,并重新计算所有对象的屏幕坐标和视图分辨率。它还可以重新生成图形数据库的索引,以优化显示和对象选择性能。

VB.NET

'' 重画图形  Redraw the drawing
Application.UpdateScreen()
Application.DocumentManager.MdiActiveDocument.Editor.UpdateScreen()
 
'' 重生成图形  Regenerate the drawing
Application.DocumentManager.MdiActiveDocument.Editor.Regen()

C#

// 重画图形  Redraw the drawing
Application.UpdateScreen();
Application.DocumentManager.MdiActiveDocument.Editor.UpdateScreen();
 
// 重生成图形  Regenerate the drawing
Application.DocumentManager.MdiActiveDocument.Editor.Regen();
VBA/ActiveX 代码参考