When an object has been loaded and, if necessary, brought up to date, the object can be displayed or printed with the container document. To display an object, the client application should set up the device context and bounding rectangle (ensuring that they use the same mapping mode) and then call the OleDraw function. The client application can use the OleQueryBounds function to retrieve the size of the bounding rectangle on the target device.
An object handler can be used to draw an object. If an object handler exists for an object, the call to the OleDraw function is received and processed by the object handler. If there is no object handler, the client library uses the object's presentation data to display or print the object.
If the presentation data for an object is a metafile, the library periodically sends an OLE_QUERY_PAINT notification to the client's callback function while drawing the object. If the callback function returns FALSE, the OleDraw func-tion returns immediately and the drawing is ended. A client could also use the OLE_QUERY_PAINT notification to take some actions within the callback function and then return TRUE to indicate that drawing should continue. Any actions the client takes at this time should not interfere with the drawing operation; for example, the client should not scroll the window.
If the target device for an object changes (for example, when the user changes printers), the client application should call the OleSetTargetDevice function. The client should also call OleSetTargetDevice whenever an object is created or loaded.
If the size of the presentation rectangle for the object changes (for example, through action by the user) the client application should call the OleSetBounds function. After calling OleSetBounds, the client should call the OleUpdate function to update the object and then OleDraw to redisplay it.