On Feb 15, 2006, at 9:22 AM, Brad Hutchings wrote:
On Feb 15, 2006, at 9:14 AM, Tom Buchler wrote:
I've been reading Aaron's article regarding DoubleBufferedCanvas
(http://ramblings.aaronballman.com/?p=376). One of his comments
(and the whole thrust of the article) is that the class he
designed is largely supposed to act as a drop-in replacement for
the built-in canvas control.
The correct way is for the Canvas to draw itself in its Paint
event. Don't know what else to say here... Yes, nothing disallows
drawing to the canvas's graphics from outside, but it's not how you
do things if you want to benefit from buffered canvases and other
things that assume you're drawing the "correct" way. Sorry.
This is kinda funny, because I had this discussion with my Dad (who
writes fun stuff in REALbasic) a couple months ago, and he was
pretty irritated with me until he "got it" about how to work with
canvases. Again, sorry.
While I agree with you, I think that Joe Strout would not -- I
believe that he always tries to draw from outside the Paint() event
if possible, and avoids calling Refresh on the Control unless
absolutely necessary (which would trigger the Paint() event).
We all have different coding styles and this is one of those areas
which I think that both methods are valid as long as they are handled
correctly, though I believe that Joe's approach is more efficient.
The funny thing is that my approach is just about split down the
middle, and uses the advantages of both techniques...
So what I have done is create a BufferedCanvas control which is
similar in almost all ways to the double-buffered canvas that Aaron
Ballman wrote in his blog. One difference is that the BufferedCanvas
is designed to work with the Paint() event, but it is also designed
to give direct access to the buffer Graphics and buffer.Mask Graphics
objects... the only difference is that you will need to manually call
the "Update" function to force the buffer to be drawn to the screen.
For more info, take a look at the description and example project here:
http://developer.dreystone.com/bufferedcanvas.php
_______________________________________________
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>