Control.Update 方法


使控制項重繪其工作區內的失效區域。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:

  • 您可以搭配 Update 方法使用 Invalidate 方法的其中一個多載。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,並將它與 Update搭配使用。This 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.