다음을 통해 공유


IOleObject::SetExtent (Windows CE 5.0)

Send Feedback

This method informs an object of how much display space its container has assigned it.

HRESULT SetExtent( DWORD dwDrawAspect, SIZEL* psizel);

Parameters

  • dwDrawAspect
    [in] Describes which form, or "aspect," of an object is to be displayed. The object's container obtains this value from the enumeration DVASPECT (see the FORMATETC enumeration).

    The most common aspect is DVASPECT_CONTENT, which specifies a full rendering of the object within its container.

    An object can also be rendered as an icon, a thumbnail version for display in a browsing tool, or a print version, which displays the object as it would be rendered using the File Print command.

  • psizel
    [in] Pointer to the size limit for the object.

Return Values

This method supports the standard return value E_FAIL, as well as the values described in the following table.

Value Description
S_OK The object has resized successfully.
OLE_E_NOTRUNNING The object is not running.

Remarks

A container calls SetExtent to dictate to an embedded object the size at which it will be displayed. Often, this call occurs in response to a user resizing the object window.

Upon receiving the call, the object, if possible, should recompose itself gracefully to fit the new window.

When possible, a container seeks to display an object at its finest resolution, sometimes called the object's native size. However, all objects have a default display size specified by their applications, and in the absence of other constraints, this is the size they use to display themselves.

Because an object knows its optimum display size better than does its container, the latter normally requests that size from a running object by calling IOleObject::GetExtent.

When the container cannot accommodate the value returned by the object, it overrides the object's preference by calling SetExtent.

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Notes to Callers

You can call SetExtent on an object only when the object is running.

If a container resizes an object while an object is not running, the container should keep track of the object's new size but defer calling SetExtent until a user activates the object.

If the OLEMISC_RECOMPOSEONRESIZE bit is set on an object, its container should force the object to run before calling SetExtent.

As noted above, a container might want to delegate responsibility for setting the size of an object's display site to the object itself, by calling GetExtent.

Notes to Implementers

You might want to implement this method so your object rescales itself to match as closely as possible the maximum space available to it in its container.

If an object's size is fixed, that is, if it cannot be set by its container, SetExtent should return E_FAIL. This is always the case with linked objects, whose sizes are set by their link sources, not by their containers.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Oleidl.h, Oleidl.idl.
Link Library: Oleaut32.lib, Uuid.lib.

See Also

DVASPECT

See Also

IOleObject | Determining Supported COM APIs | DVASPECT | FORMATETC | IOleObject::GetExtent

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.