|
|
 |
 |
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
(Publisher: The Coriolis Group)
Author(s): Steven Holzner
ISBN: 1576102831
Publication Date: 08/01/98
Layering Graphics With The AutoRedraw And ClipControls Properties
When you create graphics in Visual Basic, bear in mind that graphical controls and labels, nongraphical controls, and graphics methods appear on different layers. The behavior of these layers depends on three things: the AutoRedraw property, the ClipControls property, and whether graphics methods appear inside or outside the Paint event. Usually the layers of a form or other container are as follows:
- Front layerNongraphical controls like command buttons, checkboxes, and file controls.
- Middle layerGraphical controls and labels.
- Back layerDrawing space for the form or container. This is where the results of graphics methods appear.
Anything in one layer covers anything in the layer behind it, so graphics you create with the graphical controls appear behind the other controls on the form, and all graphics you create with the graphics methods appear below all graphical and nongraphical controls. Combining settings for AutoRedraw and ClipControls and placing graphics methods inside or outside the Paint event affects layering and the performance of the application. You can find the effects created by different combinations of AutoRedraw and ClipControls and placement of graphics methods in Table 18.3.
Table 18.3 Layering with AutoRedraw and ClipControls.
| AutoRedraw
| ClipControls
| Methods In/Out Paint Event
| Description
|
| True
| True (default)
| Paint event ignored
| Normal layering.
|
| True
| False
| Paint event ignored
| Normal layering. Forms with many controls that do not overlap may paint faster because no clipping region is calculated or created.
|
| False (default)
| True (default)
| In
| Normal layering.
|
| False
| True
| Out
| Nongraphical controls in front. Graphics methods and graphical controls appear mixed in the middle and back layers. Not recommended by Microsoft.
|
| False
| False
| In
| Normal layering, affecting only pixels that were previously covered or that appear when resizing a form.
|
| False
| False
| Out
| Graphics methods and all controls appear mixed in the three layers. Not recommended by Microsoft.
|
|