On Oct 23, 2006, at 18:10 UTC, Peter Mitchell wrote: > Here is what I'm trying to accomplish. I have a form that gets > displayed. I want to be able to display a static background picture > in a canvas on the form and provide basic tools like in a simple > paint application that allows the user to be able to draw over the > picture. But if they want to erase something they added I don't want > the background picture to get erased.
Right. Call the content that the user is drawing the "foreground." This is represented in your code by a picture (perhaps called mForeground). So, on a double-buffered system, whenever the user changes the foreground (by painting, erasing, or anything else), you simply: 1. Draw the background picture to the canvas.graphics 2. Draw the foreground picture to the canvas.graphics On a non-double-buffered system like Windows, you need a couple extra steps, as described in my previous reply. > Then, when the form is saved, I save all the input in the fields and > I wanted to save just what they have drawn over the static background > picture. Right -- you just save mForeground. > If the form is re-opened I would then display the original > static background picture with what they have drawn over top of it. Yep; you reload the foreground picture, then execute steps 1 and 2 above as with any other change to the foreground content. > So I had set up a buffer to draw into. Then I draw the buffer picture > into the canvas. Handling the erasing part and trying to keep the > static picture separate from the user drawn input is giving me problems. It shouldn't; I think you're simply skipping step 1 above, which (as you found) doesn't generally work. > Maybe I should be creating a mask for the user input drawing? I > realize I don't really understand the way everything gets redrawn. It gets drawn exactly as you tell it to draw (in general; let's ignore the Paint event for now, and by the way, avoid using the Canvas.Background property too, since that just muddies the waters). You want to see the background behind the foreground, so tell it to draw the background, then draw the foreground. > Any suggestions on what I can read that explains this and could help > with what I'm trying to accomplish? A specific book, or article on > RBLibrary that would be appropriate? Hopefully this email will do the trick. :) If not, please explain what's still confusing, and I'll try to clarify. Best, - Joe -- Joe Strout -- [EMAIL PROTECTED] Verified Express, LLC "Making the Internet a Better Place" http://www.verex.com/ _______________________________________________ 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>
