Purpose |
Select the graphic target (window,
control, or
|
Syntax |
GRAPHIC ATTACH hWin, id [, REDRAW] |
Remarks |
This statement chooses a graphic target. All further graphic operations will be directed to this target until another GRAPHIC ATTACH or GRAPHIC DETACH statement is executed, or the graphic target is deleted. All PowerBASIC graphical displays are persistent -- they will be automatically redrawn even if minimized or temporarily covered by another window. By default, all graphic operations are displayed immediately upon execution of a graphic statement. In many cases, this is a good choice, because the display is always up-to-date. However, as the complexity of graphic operations increases, this continuous update process does not afford the best performance. It is usually better to use the REDRAW option described below, as it will generally provide a dramatic improvement in overall performance. |
hWin |
Handle of the GRAPHIC
WINDOW, DIALOG, or
|
id |
The control id, if the target is a Graphic Control, or zero if the target is a GRAPHIC WINDOW or BITMAP. |
REDRAW |
This option can provide a dramatic improvement in the execution speed of graphic statements, as it eliminates repetitive updates to the display. If this option is included, all drawing statements are buffered until a GRAPHIC REDRAW statement is executed, or the operating system chooses to update the target window. Without REDRAW, all graphical statements (Line, Box, Print, etc.) are performed immediately. However, in most cases, it's better to defer the display until a number of statements have been performed. |
Example |
' Draw a blue gradient fill. ' Each line is displayed as it's drawn. |
See also |
CONTROL ADD GRAPHIC, GRAPHIC BITMAP LOAD, GRAPHIC BITMAP NEW, GRAPHIC DETACH, GRAPHIC WINDOW |