Benito van der Zander wrote 21 lines
>
>Hi again, I'm doing some transformations on a TImage using
>Canvas.CopyRect
For changing pictures a TPaintBox is better
>I need to do something similar to TListView's Items.BeginUpdate - Items.EndUpdate.
That doesn't exist for images, only temporary images and the
doublebuffered property.
>When the user moves the mouse
>again, before doing anithing, I paint the original area with the
>temporary bitmap to obtain the original image, then re-draw on the new
>area. This causes flickering, and I thing it can be avoided using
>something like BeginUpdate at the beginning of my method and EndUpdate
>at the end
Draw the area around new and old mouse position in an temporary image, and
then draw the original image as well as the redrawing on that temporary image, and
this temporary image on the visible control.
Then only one drawing changes the visible image and it can't flicker.
Benito
Thanks Benito. I'm doing more or less what you say, but I can't get the desired results.
Could you take a look at the attached example?
Basically I'm doing this:
1) Define a TRect surrounding the mouse, a 40 by 40 pixels area
2) Define a TRect to contain the zoomed area, the same rect defined in (1) multiplied by a zoom factor.
3) Store the area defined in (2) into a temporary bitmap.
4) Using Canvas.CopyRect, I stretch the small rect (1) into (2) to get the zoom effect.
5) The next time the user moves the mouse, the program checks if theres's a temporary bitmap, then draw it in the same position captured in 3, and paint it into the image. I do this to restore the original image, then the steps 1 to 4 are repeated again.
The problem is, in steps 4 and 5, I do a Canvas.CopyRect on the original image, and when the user moves the mouse, the temporary image is shown just before the zoomed one, and I don't want the user note this flickering.