|
OleDraw
The OleDraw helper function can be used to draw objects more easily. You can use it
instead of calling IViewObject::Draw directly.
STDAPI OleDraw(
IUnknown * pUnk,
| //Points to the view object to be drawn
| DWORD dwAspect,
| //Specifies how the object is to be represented
| HDC hdcDraw,
| //Identifies the device context on which to draw
| LPCRECT lprcBounds
| //Specifies the rectangle in which the object is drawn
| );
|
|
Parameters
pUnk
Points to the view object that is to be drawn.
dwAspect
Specifies 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 DVASPECT. See DVASPECT for more information.
hdcDraw
Specifies the device context on which to draw. Cannot be a metafile device
context.
lprcBounds
Points 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::Draw.
Return Values
S_OK
Indicates object was successfully drawn.
E_INVALIDARG
Indicates one or more arguments are invalid.
E_OUTOFMEMORY
Indicates ran out of memory.
OLE_E_BLANK
Indicates there is no data to draw from.
E_ABORT
Indicates the draw operation was aborted.
VIEW_E_DRAW
Indicates an error occurred in drawing.
OLE_E_INVALIDRECT
Indicates the rectangle is invalid.
DV_E_NOIVIEWOBJECT
Indicates the object doesn't support the IViewObject interface.
Comments
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
IViewObject::Draw
Related LinksSoftware for Delphi and C++ Builder developers Software for Visual Studio .NET developers Software for Visual Basic 6 developers Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps Win32 Programmer's Reference (win32.hlp) Win32 Multimedia Programmer's Reference (mmedia.hlp) Microsoft Windows Pen API Programmer's Reference (penapi.hlp) Microsoft Windows Sockets 2 Reference (sock2.hlp) Microsoft Windows Telephony API (TAPI) Programmer's Reference (sock2.hlp) Unix Manual Pages
|