#include <ole.h> |
OLESTATUS OleDraw(lpObject, hdc, lprcBounds, lprcWBounds, hdcFormat) | |||||
LPOLEOBJECT lpObject; | /* address of object to draw | */ | |||
HDC hdc; | /* handle of DC for drawing object | */ | |||
const RECT FAR* lprcBounds; | /* bounding rectangle for drawing object | */ | |||
const RECT FAR* lprcWBounds; | /* bounding rectangle for metafile DC | */ | |||
HDC hdcFormat; | /* handle of DC for formatting object | */ |
The OleDraw function draws a specified object into a bounding rectangle in a device context.
lpObject
Points to the object to draw.
hdc
Identifies the device context in which to draw the object.
lprcBounds
Points to a RECT structure defining the bounding rectangle, in logical units for the device context specified by the hdc parameter, in which to draw the object.
lprcWBounds
Points to a RECT structure defining the bounding rectangle if the hdc parameter specifies a metafile. The left and top members of the RECT structure should specify the window origin, and the right and bottom members should specify the window extents.
hdcFormat
Identifies a device context describing the target device for which to format the object.
The return value is OLE_OK if the function is successful. Otherwise, it is an error value, which may be one of the following:
OLE_ERROR_ABORT
OLE_ERROR_BLANK
OLE_ERROR_DRAW
OLE_ERROR_MEMORY
OLE_ERROR_OBJECT
This function returns OLE_ERROR_ABORT if the callback function returns FALSE during drawing.
When the hdc parameter specifies a metafile device context, the rectangle specified by the lprcWBounds parameter contains the rectangle specified by the lprcBounds parameter. If hdc does not specify a metafile device context, the lprcWBounds parameter is ignored.
The library may use an object handler to render the object, and this object handler may need information about the target device. Therefore, the device-context handle specified by the hdcFormat parameter is required. The lprcBounds parameter identifies the rectangle on the device context (relative to its current mapping mode) that the object should be mapped onto. This may involve scaling the picture and can be used by client applications to impose a view scaling between the displayed view and the final printed image.
An object handler should format an object as if it were to be drawn at the size specified by a call to the OleSetBounds function for the device context specified by the hdcFormat parameter. Often this formatting will already have been done by the server application; in this case, the library simply renders the presentation data with suitable scaling for the required bounding rectangle. If cropping or banding is required, the device context in which the object is drawn may include a clipping region smaller than the specified bounding rectangle.