IOleInPlaceSiteWindowless::ScrollRect  19EEQGT

Enables an object to scroll an area within its in-place active image on the screen.

HRESULT ScrollRect(

    int dx,

//Amount to scroll on the x-axis

    int dy,

//Amount to scroll on the y-axis

    LPCRECT pRectScroll,

//Rectangle to scroll

    LPCRECT pRectClip

//Rectangle to clip

   );

 

 

Parameters

dx

[in] Amount to scroll on the x-axis.

dy

[in] Amount to scroll on the y-axis.

pRectScroll

[in] Rectangle to scroll, in client coordinates of the containing window. NULL means the full object.

pRectClip

[in] Rectangle to clip to as defined for the Windows API function. Only pixels scrolling into this rectangle are drawn. Pixels scrolling out are not. If this parameter is NULL, the rectangle is not clipped.

 

Return Values

S_OK

The rectangle was successfully scrolled.

 

Remarks

This method should take in account the fact that the caller may be transparent and that there may be opaque or transparent overlapping objects. See Notes to Implementers below for suggestions on algorithms this method can use.

Note to Implementers

Containers can implement this method in a variety of ways. However, all of them should account for the possibility that the object requesting scrolling may be transparent or may not have a solid background. Containers should also take into account that there may be overlapping objects.

The simplest way to implement this method consists in simply redrawing the rectangle to scroll.

An added refinement to this simple implementation is to use the ScrollDC Windows API function when the object requesting the scroll is opaque, the object has a solid background, and there are no overlapping objects.

More sophisticated implementations can use the following procedure:

    Check whether the object is opaque and has a solid background, using IViewObjectEx::GetViewStatus. If not, simply invalidate the rectangle to scroll. An added refinement is to check whether the scrolling rectangle is entirely in the opaque region of a partially transparent object.

    Get the window device context.

    Clip out the opaque parts of any overlapping object returned by IViewObjectEx::GetRect.

    Clip out and invalidate the transparent parts of any overlapping object.

    Finally, call the Windows API function ScrollDC.

    Redraw the previously invalidated transparent parts of any overlapping object.

 

Regardless of the scrolling and clipping rectangle, only pixels contained in the object s site rectangle will be painted. The area uncovered by the scrolling operation is invalidated and redrawn immediately, before this method returns.

All redraw generated by this method should happen synchronously before this method returns.

This method should automatically hide the caret during the scrolling operation and should move the caret by the scrolling amounts if it is inside the clip rectangle.

See Also

IViewObjectEx::GetViewStatus, IViewObjectEx::GetRect