|Draw with GC on Canvas and redraw the canvas [message #460784]
||Wed, 07 September 2005 06:24
Originally posted by: ssc.acentic.net|
I have a little problem with GC. I like to draw something, in this case
on a canvas. Drawing is not the problem, but redraw the canvas and drawing
something in the same method seems to be.
gc = new GC(canvas);
gc.fillRectangle(0, 0, 100, 20);
With this code, I do not see the green rectangle. If I remove the redraw
command, it works, but it will paint over and over again.
Any idea how to avoid this ?
|Re: Draw with GC on Canvas and redraw the canvas [message #460806 is a reply to message #460786]
||Wed, 07 September 2005 13:16
Originally posted by: richkulp.us.NO_SPAM.ibm.com|
You really should not be doing drawing outside of a PaintListener
callback. That is because there are many reasons why your Canvas could
be redrawn. Such as someone covered it up and then reexposed it. In that
case your extra drawing will disappear. Instead you should add a
PaintListener and use the GC passed into the PaintListener to do your
extra painting. That way it will show up no matter why the Canvas was
Sebastian Scholz wrote:
> Nevermind, a simple canvas.update(); after the redraw, did the job.
Powered by FUDForum
. Page generated in 0.02316 seconds