From Xojo Documentation
Scrolls the Canvas contents according to the passed parameters.
DeltaX and DeltaY are the number of points to scroll horizontally and vertically relative to the current position of the picture in the Canvas control. Positive values scroll right and down while negative values scroll left and up. The Left, Top, Width, and Height parameters specify the portion of the picture to be scrolled. If these are not passed, the entire picture will be scrolled. ScrollControls indicates whether controls positioned on top of the Canvas control should be scrolled as well. ScrollControls is True by default.
To use the Scroll method to scroll the contents of a Canvas control, you need to store the last scroll value for the axis you are scrolling so you can use this to calculate the amount to scroll. This can be done by adding properties to the window that contains the Canvas control or by creating a new class based on the Canvas control that contains properties to hold the last X scroll amount and last Y scroll amount.
If the ScrollControls parameter is True, any controls on top of the Canvas control will also be scrolled. This allows the implementation of a scrolling pane of controls.
The following example scrolls a picture that was added to the project. The properties XScroll and YScroll have been added to the window to hold the amounts the picture has been scrolled. The picture is scrolled 8 points at a time. In the Keydown event of the window, the following code calls the Scroll method whenever the Up, Down, Left, or Right arrow keys are pressed.
Const RightArrow = 29
Const UpArrow = 30
Const DownArrow = 31
Const ScrollUnit = 8 // points
Select Case Asc(Key)
XScroll = XScroll + ScrollUnit
XScroll = XScroll - ScrollUnit
YScroll = YScroll + ScrollUnit
YScroll = YScroll - ScrollUnit
The Scroll method calls the Paint event of the canvas that redraws the picture with the new values of XScroll and YScroll. The Paint event has the following line of code: