This documentation is archived and is not being maintained.


Called by the framework when the user views an area beyond the present view of the document, either by dragging an OLE item against the view's current borders or by manipulating the vertical or horizontal scrollbars.

virtual BOOL OnScrollBy(
   CSize sizeScroll,
   BOOL bDoScroll = TRUE 



Number of pixels scrolled horizontally and vertically.


Determines whether scrolling of the view occurs. If TRUE, then scrolling takes place; if FALSE, then scrolling does not occur.

Nonzero if the view was able to be scrolled; otherwise 0.

In derived classes this method checks to see whether the view is scrollable in the direction the user requested and then updates the new region if necessary. This function is automatically called by CWnd::OnHScroll and CWnd::OnVScroll to perform the actual scrolling request.

The default implementation of this method does not change the view, but if it is not called, the view will not scroll in a CScrollView-derived class.

If the document width or height exceeds 32767 pixels, scrolling past 32767 will fail because OnScrollBy is called with an invalid sizeScroll argument.