The OleDraw helper function can be used to draw objects more easily. You can use it instead of calling IViewObject::Draw directly.
WINOLEAPI OleDraw(
IUnknown * pUnk, |
//Pointer to the view object to be drawn |
DWORD dwAspect, |
//How the object is to be represented |
HDC hdcDraw, |
//Device context on which to draw |
LPCRECT lprcBounds |
//Pointer to the rectangle in which the object is drawn |
); |
Parameters
Return Values
This function supports the standard return values E_INVALIDARG and E_OUTOFMEMORY, as well as the following:
Remarks
The OleDraw helper function calls the QueryInterface method for the object specified (pUnk), asking for an IViewObject interface on that object. Then, OleDraw converts the RECT structure to a RECTL structure, and calls IViewObject::Draw as follows:
lpViewObj->Draw(dwAspect,-1,0,0,0,hdcDraw,&rectl,0,0,0);
Do not use OleDraw to draw into a metafile because it does not specify the lprcWBounds parameter required for drawing into metafiles.
See Also