EnablePaint property (Main Control)

Visual Basic example
Visual C++ 4.0 example

Syntax BOOL EnablePaint

Overview:  Refer to Displaying an Image.

Remarks

Enables or disables the painting of a window. Possible values are:

Value

Meaning

TRUE

The control will repaint when its window is invalidated.

FALSE

The control will not repaint, even if it has a bitmap and its window is invalidated.

The default value is TRUE (control will repaint its window).

Note that this should not be confused with AutoRepaint. AutoRepaint will not disable the paint when set to FALSE. When AutoRepaint is set to false, the control will not repaint automatically – it will repaint only when the window is invalidated or when you call ForceRepaint.

This can be illustrated like this:

EnablePaint = FALSE -> control will never paint its window.

EnablePaint = TRUE -> control will paint is window.

AutoRepaint = TRUE -> The control will repaint its window when:

1. Its window is invalidated (when you move a window that covered the control.

2. You scrolled its window (by clicking its scroll bars or using the pan window or setting AutoPan to TRUE and dragging the mouse).

3. It detects that you changed its bitmap (you changed one or more pixels, or you called a method that changed the bitmap).

AutoRepaint = FALSE -> Control will repaint only in situation 1) or 2) from above. (In other words, it will disable its automatic repainting mechanism).

This property would be useful if you are going to change the control’s window size several times. In this case, you might want to disable the paint until you decide on the final size.

See Also

Elements: AutoRepaint property, ForceRepaint method

Topics:  Raster Images: Displaying Images