[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Simple bitmap question
Robby:
> Yep, you need to use on-paint. Try this:
>
> (define bm-canvas%
> (class canvas%
> (inherit get-dc)
> (define/override (on-paint)
> (send (get-dc) draw-bitmap bitmap 0 0))
> (super-instantiate ())))
>
This works. But I still don't understand why I need to override on-paint.
The help desk states this about on-paint:
Called when the canvas is exposed or resized so that the image in the
canvas can be repainted.
My program ends like this:
(send frame show #t)
(define dc (send canvas get-dc))
(send dc draw-bitmap bitmap 0 0 )
I understand that (send frame show #t) triggers an on-paint event.
But I draw my bitmap afterwards. Does draw-bitmap trigger an on-paint event
too,
or is it something else that comes into play?
--
Jens Axel