Control.Update 方法

定义

使控件重绘其工作区内的无效区域。Causes the control to redraw the invalidated regions within its client area.

public:
 void Update();
public void Update ();
member this.Update : unit -> unit
Public Sub Update ()

注解

执行用于绘制的任何挂起的请求。Executes any pending requests for painting.

可以通过两种方式重绘窗体及其内容:There are two ways to repaint a form and its contents:

  • 可以通过方法使用方法的重载之一 Invalidate UpdateYou can use one of the overloads of the Invalidate method with the Update method.

  • 可以调用 Refresh 方法,这会强制控件重绘其自身及其所有子级。You can call the Refresh method, which forces the control to redraw itself and all its children. 这等效于将方法设置 Invalidatetrue ,并将其与一起使用 UpdateThis is equivalent to setting the Invalidate method to true and using it with Update.

Invalidate方法控制绘制或重绘的内容。The Invalidate method governs what gets painted or repainted. Update方法控制何时发生绘制或重画。The Update method governs when the painting or repainting occurs. 如果 Invalidate 同时使用和 Update 方法,而不是调用,则重 Refresh 绘的内容取决于 Invalidate 你使用的重载。If you use the Invalidate and Update methods together rather than calling Refresh, what gets repainted depends on which overload of Invalidate you use. Update方法只是强制立即绘制控件,而 Invalidate 方法控制在调用方法时绘制的内容 UpdateThe Update method just forces the control to be painted immediately, but the Invalidate method governs what gets painted when you call the Update method.

有关详细信息,请参阅 WM_PAINT 主题。For more information, see the WM_PAINT topic.

适用于

另请参阅