IOleInPlaceSiteWindowless::ScrollRect

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:

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.

QuickInfo

  Windows NT: Use version 4.0 or later. New for OC96.
  Windows: Use Windows 95 or later. New for OC96.
  Windows CE: Unsupported.
  Header: Declared in ocidl.h.

See Also

IViewObjectEx::GetViewStatus, IViewObjectEx::GetRect