Control.Update Control.Update Control.Update Control.Update Method


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

 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方法替换Update方法。You 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. 这相当于设置Invalidate方法true并将其与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. 如果您使用InvalidateUpdate方法一起使用,而不是调用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方法控制所绘制的调用时Update方法。The 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.