Method XbpMetaFile():draw() Foundation

Replays the metafile in a presentation space (display the image).

:draw( [<oPS>], [<nMode>|<aRectangle>] ) --> lSuccess
The optional <oPS> parameter specifies a presentation space where the metafile is displayed. If the current window is an XbpCrt window, <oPS> does not need to be specified. In this case, the return value of SetAppWindow():presSpace() is used for <oPS>. In all other cases <oPS> is not optional and the presentation space must either have been explicitly created using XbpPresSpace():new() or the "MicroPS" of an Xbase Part must be requested using the method :lockPS(). The MicroPS must be released after graphic output using the :unlockPS() method.
Constants listed in the following table are used for <nMode>. They are defined in XBP.CH:
Constants for the drawing mode
Constant Description
XBPMETA_DRAW_INITPS Initializes the presentation space with the settings used while recording the meta file.
XBPMETA_DRAW_SCALE Scales a meta file to the size of the presentation space.
XBPMETA_DRAW_DEFAULT *) Displays the meta file unaltered in the presentation space.
  1. default
<aRectangle> := { <nX1>, <nY1>, <nX2>, <nY2> }
Instead of a #define constant, a 4-element array <aRectangle> can be specified as second parameter. It identifies a rectangular area into which the image of the meta file is drawn. <nX1> and <nY1> indicate the point at the lower left corner. <nX2> and <nY2> designate the upper right corner of the area. The coordinates must be given according to the unit set for the presentation space (e.g. GRA_PU_PIXEL, GRA_PU_LOMETRIC).

This method returns the value .T. (true) if the graphic data from the metafile could be displayed in the specified presentation space, otherwise .F. (false) is returned.


The :draw() method "plays back" a metafile in a presentation space. The graphic information from the metafile is drawn in the presentation space. The metafile must have been previously loaded into memory using the :load() method.

Where the drawing is visible depends on the device context linked to the presentation space. By default, the presentation space of the current window is used and the graphic data from the metafile is displayed on the screen. In order to print a saved drawing, a presentation space must be specified that is linked with a printer device context (see XbpPrinter()).


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.