That works perfectly, thanks David!
(define (resize-draw canvas0 bm)
(let* ((dc (send canvas0 get-dc))
(t (send dc get-transformation)))
(send dc scale
(/ (send canvas0 get-width) (send bm get-width))
(/ (send canvas0 get-height) (send bm get-height)))
(send dc
Usually you adjust the drawing context's scale. Something like (untested):
(define bm (read-bitmap ...))
(define dc (send image-box get-dc))
(define t (send dc get-transformation)) ; save old scale
(send dc scale
(/ (send image-box get-width) (send bm get-width))
(/ (send image-box
(define image-box
(new canvas% [parent frame]
[min-width 300]
[min-height 300]))
I'm still trying to figure out how the racket/gui library works but I'm
having some difficulty understanding how to have an image fill a canvas.
I'd like for instance to have a canvas in my gui that
3 matches
Mail list logo