On Jan 28, 2007, at 3:44 PM, Steve Roy wrote:
Hi everyone,
After all this time using RB canvases I have always done my own
computation and repainting instead of using Scroll, so now today
I'm playing around trying to figure out how Scroll can help me out.
I'm not sure I get it. It does scroll, but it doesn't scroll the
entire image like the docs say. Only the size of the canvas is
scrolled, leaving some artifacts not repainted. Here's a screen
shot of what I mean.
<http://homepage.mac.com/sroy/ScrollTest.png>
Here's an example. I set the Backdrop property of a canvas to some
image (much bigger than the canvas size). Then in the canvas event
handlers I have this code:
Function MouseDown(X as Integer, Y as Integer) as Boolean
AnchorX = x
AnchorY = y
return true
End Function
Sub MouseDrag(X as Integer, Y as Integer)
me.Scroll(x - AnchorX, y - AnchorY)
AnchorX = x
AnchorY = y
End Sub
Running it, the image does move when I drag the mouse on the
canvas, but only the portion of the image that was visible is
repainted. The result is the screen shot I linked above.
I tried passing the size of the image in Scroll() but all that
changed is that white was added to the visible portion that was
repainted. Basically it doesn't repaint the image. And if it
doesn't, then I wonder what good Scroll does me.
Scroll is good to scroll embedded controls, that works. But for an
image, what is the correct usage?
The correct usage is not to use Scroll for this. There is a
PictureViewer example on my web site that shows to how scroll images
by drawing them in the Paint handler with the scroll offset.
And don't use the Backdrop property; that's for sales and marketing
purposes only :)
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>