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

定义

使控件重绘其工作区内的无效区域。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 可以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 ,并将其与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. 如果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. 方法只是强制立即绘制控件, Invalidate而方法控制在调用Update方法时绘制的内容。 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.

适用于

另请参阅