RectControl.Invalidate

From Xojo Documentation

Method

RectControl.Invalidate([EraseBackground as Boolean])

Supported for all project types and targets.

Similar to Refresh, but causes the control to be marked dirty and to be redrawn when the window contents need to be redrawn.

Notes

If the optional parameter EraseBackground is True, the background will be erased prior to redrawing the control. The default is True.


Method

RectControl.Invalidate(X As Integer, Y As Integer, Width As Integer, Height As Integer [,EraseBackground As Boolean])

Supported for all project types and targets.

Similar to RefreshRect, but causes the specified region of the RectControl to be marked dirty and to be redrawn when the window contents need to be redrawn. The region to be redrawn is specified by the X, Y, Width, and Height parameters. This form of Invalidate was formerly called InvalidateRect.

If the optional parameter EraseBackground is True, the background will be erased prior to redrawing the control. The default is True.

Notes

To redraw a control immediately, call Refresh or Refreshrect. For example, this would be appropriate from a tight loop, if you need the screen to be updated but there is no chance for your app's main event loop to execute in the meantime.

Otherwise, it is generally more efficient to call Invalidate, which tells the operating system that the control (or part of it) needs to be redrawn. The advantage of this approach is that more than one part of the screen might be invalidated before the next general screen refresh, and the operating system can wait until that refresh to repaint all invalid regions of the screen at once.

Sample Code

The following code refreshes the control. EraseBackground defaults to True.

Me.Invalidate(False)