Paint

Occurs when part or all of an object is exposed after being moved or enlarged, or after a window that was covering the object has been moved.

Syntax

Private Sub Form_Paint( )

The Paint event syntax has these parts:

Part Description
object An object expression that evaluates to an object.

Remarks

A Paint event procedure is useful if you have output from graphics methods in your code. With a Paint procedure, you can ensure that such output is repainted when necessary.

The Paint event is invoked when the Refresh method is used.

If the ClipControls property is set to False, graphics methods in the Paint event procedure affect only newly exposed areas of the form; otherwise, the graphics methods repaint all areas of the form not covered by controls (except Label, Line, and Shape controls).

Note Using a Refresh method in a Resize event procedure forces repainting of the entire object every time a user resizes the form.

Using a Paint event procedure for certain tasks can cause a cascading event. In general, avoid using a Paint event procedure to do the following:

A Resize event procedure may be more appropriate for some of these tasks.