Prevent drawing trail and flickering

How do I clear a drawing trial in the paint event of a canvas. I have tried the ClearRect, refresh and invalidate function but that either flickers or makes a trial, depending on whether EraseBackground is enabled. How do I do this without flickering?
Thanks!

I’m not sure to understand flickering, but use the doublebuffer isn’t a solution?

Oh yeah. I thought I had double buffer enabled. Thanks.

Yeah, to elaborate, DoubleBuffer on and EraseBackground off is the trick. You lose transparency though. With both false, you won’t flicker, but your previous contents are not erased. With both true, massive flicker.

Since the problem is resolved, I ask another question:
I have a PNG picture with transparency “Mode0img.png”.
Those codes are in the Paint event of my canvas.

If I paste directly in the Cancas, The Transparency is ok.

g.DrawPicture Mode0img, 0, 0

If I do

[code]Dim MyPict as Picture

MyPict = New Picture(g.Width, g.Height, 32)
MyPict.Graphics.DrawPicture Mode0img, 0, 0
g.DrawPicture MyPict, 0, 0[/code]
No transparency.

If I want a picture with transparency, I have to have two picture, the picture itself, and its mask. No way to have it directly?

Omit the depth parameter when creating the picture to have a translucent picture with no mask.

Ok, I wrote MyPict = New Picture(g.Width, g.Height) and it works with Cocoa, but not with Carbon (NotSupported plateform exception).
Thank you.

That’s correct. Needs GDI+ enabled on Windows as well.