ClipControls Property

See Also137QUFD              ExampleHTOG7Z>Low

Applies To

Form14TJ2LN, frame1KX6ZP8, picture box31MYIWX.

Description

Determines whether graphics methodsAY3LGR in Paint events repaint the entire object or only newly exposed areas.  Also determines whether the Windows environment creates a clipping region that excludes non-graphic controls contained by the object.

Usage

[form.][frame.|picturebox.]ClipControls

Setting

The ClipControls property settings are:

Setting          Description

 

True              (Default) Graphics methods in Paint events repaint the entire object.  A clipping region is created around non-graphical controls on the form before a Paint event.

False             Graphics methods in Paint events repaint only newly exposed areas.  A clipping region is not created around non-graphical controls before a Paint event.  Complex forms usually load and repaint faster.

 

Remarks

Clipping is the process of determining which parts of a form or container, such as a frame or picture box, are painted when the form is displayed.  An outline of the form and controls is created in memory.  The Windows environment uses this outline to paint some parts, such as the background, without affecting other parts, such as the contents of a text box.  Since the clipping region is created in memory, setting this property to False can reduce the time needed to paint or repaint a form.

The clipping region includes most controls, but does not clip around the image, label, line, or shape controls.

Data Type

IntegerDOKXHY (Boolean)


See Also

Help:

AutoRedraw Property1UY7ZM3

Circle Method38E9WK

Line MethodGU01B0

Paint Event25UTDKO

Print Method9V51E5

 

Programmer's Guide:

Chapter 15, "Creating Graphics for Applications"


ClipControls Property Example

The example shows how the ClipControls property affects the repainting of a form.  To try this example, paste the code into the Declarations section of a form.  Then press F5.  Notice that the color of the entire form changes each time you resize it or cover part of it with another form or application.  End the program and change ClipControls to False and then run the program again.  Notice that only newly exposed parts of the form are repainted.

Sub Form_Paint ()

   ' Select a random color for the background.

   BackColor = &HFFFFFF * Rnd

End Sub