AutoRedraw Property (AForm)

Returns or sets whether the output from a graphics method are persistent.

Syntax

Object.AutoRedraw [ = bAutoRedraw ]

The AutoRedraw property syntax has the following parts:

 

Name

Type

Description

Object

AForm

AForm object

bAutoRedraw

Bool

A boolean expression that specifies whether the output from a graphics method are persistent.

Where

bAutoRedraw can be one of the following:

 

Value

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 doesn't receive OnPaint events; it's repainted when necessary, using the image stored in memory.

False *

Disables automatic repainting of a form and writes graphics or text only to the screen. The program invokes the form's OnPaint event when necessary to repaint the object.

Comments

This property is central to working with the following graphics methods: Circle, Cls, Line, Point, and PSet. Setting AutoRedraw to True automatically redraws the output from these methods in a form object when, for example, the object is resized or re-displayed after being hidden by another object. When AutoRedraw is False you must use the OnPaint event for drawing the form client area. The OnPaint event will be called whenever an area if the form requires painting, any area that is uncovered will be painted initially by the BackColor and the Picture properties and the drawing methods will be drawn on top of this area.

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 aren't 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 OnPaint event unless AutoRedraw is set to True.

To retrieve the persistent graphic created when AutoRedraw is set to True, use the Image property. To pass the persistent graphic to a Windows API when AutoRedraw is set to True, use the object's hDC property.

If you set a form's AutoRedraw property to False and then minimize the form, the ScaleHeight and ScaleWidth properties are set to icon size. When AutoRedraw is set to True, ScaleHeight and ScaleWidth remain the size of the restored window.

The property is not applicable for MDI Form type since drawing functions are not supported for MDI Forms.

Example

The following statement changes the AForm to enable automatic repainting of a Form object:

AutoRedraw=True

Applies to

AForm

See Also

BackColor, Circle, Cls, hDC, Line, Point, OnPaint,PSet,, ScaleHeight Scalewidth, Type