OLESTATUS OleDraw(lpObject, hDC, lpBounds, lpWBounds, hFormatDC) | |||||
LPOLEOBJECT lpObject; | /* pointer to object to draw | */ | |||
HDC hDC; | /* handle of DC for drawing object | */ | |||
const RECT FAR* lpBounds; | /* bounding rect for drawn object | */ | |||
const RECT FAR* lpWBounds; | /* bounding rect for metafile hDC | */ | |||
HDC hFormatDC; | /* 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.
lpBounds
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.
lpWBounds
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.
hFormatDC
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 can 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 lpWBounds parameter contains the rectangle specified by the lpBounds parameter. If hDC does not specify a metafile device context, the lpWBounds parameter is ignored.
The device-context handle specified by the hFormatDC parameter is required because the library may use an object handler to render the object, and the object handler may need information about the target device. The lpBounds 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 hFormatDC 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. The device context in which the object is drawn may include a clipping region smaller than the specified bounding rectangle, if cropping or banding is required.
OleSetBounds