Returns or sets the output from a graphics method to a persistent graphic.
object.AutoRedraw [= boolean]
The parts of the AutoRedraw property syntax are described in the following table.
Part | Description |
---|---|
object | An object expression that evaluates to an object. |
boolean | A Boolean expression that specifies how the object is repainted, as described in Settings. |
The settings for boolean are listed in the following table.
Setting | Description |
---|---|
True | Enables automatic repainting of a Form object. Graphics and text are written to the screen and to an image stored in memory. The object does not receive Paint events; it is repainted when necessary, using the image stored in memory. |
False | (Default). Disables automatic repainting of an object and writes graphics or text only to the screen. Visual Basic invokes the object's Paint event when necessary to repaint the object. |
This property is central to working with the following graphics methods: DrawCircle, Cls, DrawLine, and PointSet. Setting AutoRedraw to True automatically redraws the output from these methods in a Form object when, for example, the object is resized or redisplayed after being hidden by another object.
You can set AutoRedraw in code at run time to alternate between drawing persistent graphics (such as a background or grid) and temporary graphics. If you set AutoRedraw to False, previous output becomes part of the background screen. When AutoRedraw is set to False, background graphics are not deleted if you clear the drawing area with the Cls method. Setting AutoRedraw back to True and then using Cls clears the background graphics.
Note If you set the BackColor property, all graphics and text, including the persistent graphic, are erased. In general, all graphics should be displayed using the Paint event unless AutoRedraw is set to True.