OleDraw  42K7050

The OleDraw helper function can be used to draw objects more easily. You can use it instead of calling IViewObject::Draw1SUNL2 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

pUnk

[in] Pointer to the IUnknown interface on the view object that is to be drawn.

dwAspect

[in] How the object is to be represented. Representations include content, an icon, a thumbnail, or a printed document. Valid values are taken from the enumeration DVASPECT1BLGLB9. See DVASPECT for more information.

hdcDraw

[in] Device context on which to draw. Cannot be a metafile device context.

lprcBounds

[in] Pointer to a RECT structure specifying the rectangle in which the object should be drawn. This parameter is converted to a RECTL structure and passed to IViewObject::Draw1SUNL2.

 

Return Values

This function supports the standard return values E_INVALIDARG and E_OUTOFMEMORY, as well as the following:

S_OK

Object was successfully drawn.

OLE_E_BLANK

No data to draw from.

E_ABORT

The draw operation was aborted.

VIEW_E_DRAW

An error occurred in drawing.

OLE_E_INVALIDRECT

The rectangle is invalid.

DV_E_NOIVIEWOBJECT

The object doesn't support the IViewObject1VLFPYP interface.

 

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::Draw1SUNL2 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

IViewObject::Draw