What id do is this:
Set EraseBackground to false
Draw stuff to a picture
In the paint event, draw the picture to the canvas
When you need to update, call "Canvas.Refresh FALSE". This is an optional
parameter to specify whether or not the background should be erased this
time. It defaults to true, which is why normally you'd get flickering by
calling refresh. But if you say false it won't flicker (much). There is
nothing wrong with refresh, as long as you specify false.
The reason why you shouldn't just paint directly to the canvas is that it's
going to be empty if you put a window in front of it. By using the paint
event, you redraw it every time it needs to be redrawn.
Maarten
On 30/06/06, joe at strout dot net <joe at strout dot net> wrote:
On Jun 30, 2006, at 15:36 UTC, John Kubie wrote:
> The flicker I am seeing is unacceptable. As I said before, I would
> love to see an example of a simple, flicker-free project.
There are many, and it's trivial to make such. As others have pointed
out, you simply need to avoid calling Refresh; draw directly into the
canvas.graphics instead, without erasing.
If you want an example, drag two pictures into a canvas, and throw on a
checkbox with this code:
if me.Value then
Canvas1.graphics.DrawPicture picture1, 0, 0
else
Canvas1.graphics.DrawPicture picture2, 0, 0
end if
This will swap pictures on every click with no flicker, even on
non-double-buffered systems like Windows.
Best,
- Joe
--
Joe Strout -- joe at strout dot net
Verified Express, LLC "Making the Internet a Fucked up 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>
|