At 11:51 AM -0400 10/25/04, Barrie Jones wrote:
1) Should I instantiate a canvas big enough for the oversize graphic
such that only part of it shows in the window with scroll bars?
No, your canvas should be sized as it appears on the screen. The
scrollbars should be positioned outside the canvas (to the right of
it, and below it).
2) Having created the big canvas, should I use NewPicture to draw
offscreen then place it on the big canvas.
You certainly can, but if your content is very large, this will take
a lot of memory.
3) Could I make a window sized canvas (locked to the window) and do
my oversize graphics in a NewPicture, apply part of the NewPicture
to the canvas and scroll the NewPicure on the smaller canvas.
Er... isn't this the same as option 2? Anyway, the same
consideration applies: think about how big this picture will need to
be.
You really don't need a picture for this. Here's a quick example of
a scrolling canvas:
1. Throw a canvas on the window, with scrollbars next to it, called
HScroller (for horizontal) and VScroller (for vertical).
2. Make a method like this:
Sub DrawContent( g as Graphics )
g.ClearRect 0, 0, g.width, g.height
g.textSize = 128
g.DrawString "This is a test, just a test. See how it scrolls?", _
200 - HScroller.Value, 400 - VScroller.Value
End Sub
3. In the ValueChanged event of each scrollbar, put:
DrawContent Canvas1.graphics
4. In the Canvas1.Paint event, put:
DrawContent g
5. Run the app.
That should do it. It's off the top of my head though, so it may
contain some errors, but I hope it gets you started. Replace the
guts of DrawContent with your own drawing code, and you should be all
set.
Best,
- Joe
--
REAL World 2005 - The REALbasic User Conference
March 23-25, 2005, Austin, Texas
<http://www.realsoftware.com/realworld>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|