I am updating an old application from RB2006 to Xojo 2014 and I am having problems with a canvas area. Xojo says that Graphics is deprecated and I should use Paint instead. So I have been working on making changes, but I am having problems making this work cross platform.
I have a canvas area where I display a picture and the intent is to allow the user to draw on top of it in a separate layer. The user markup is saved separately, I don’t want to save the original image and the markup. On the Mac I have this close to working, but on Windows the draw picture does not display.
The old version of the application created two pictures, one for the background picture and one for the drawing. Then the paint event on the canvas would draw the two pictures, first the background picture and then the draw layer. For Windows, the application used a buffer picture to draw into. When a draw tool was used the Mac app would draw into the draw layer, the Windows app drew into the buffer picture.
I started by removing the buffer picture on Windows and figured I could just draw into the same picture like I do for the Mac. When I debug I can see the drawing changes on the draw picture, but it never displays on the canvas. All that displays is the background picture. Pictures are created like this:
mBackgroundLayer = New Picture(me.Width, me.Height, 32)
mModLayer = New Picture(me.Width, me.Height, 32)
Is it possible to layer pictures on Windows?
Would it be better to put my background picture into the background property of the canvas? (Works without doing this on Mac.)
I have just returned to using Xojo so have not kept up with changes over the years. From looking at example apps it looks like I don’t need to draw into a buffer for the Windows version of the app. (I don’t remember why it was necessary 8 years ago, but that is the way it was written.) I haven’t found exactly what I need yet in any of the user guides or forum posts. So any pointers on where to look to figure out how to make this work would be appreciated.
Note: Use GDI Plus is turned on for Windows.
Thanks,
Peter