;Program using Mr Ed that creates a frame, and draws an X to ;the inside corners of the frame which updates when the frame ;is resized. (define lines (lambda (frameWidth frameHeight) (define drawWidth 0) (define drawHeight 0) (define frame (instantiate frame% ("Resize Me") (width frameWidth) (height frameHeight)) ) ;; Make the drawing area with a paint callback (define canvas (instantiate canvas% (frame) (paint-callback (lambda (canvas dc) (draw-lines dc)) ) ) ) ;Create a pen with color red, thickness 2, ;and line type solid. (define red-pen (instantiate pen% ("RED" 2 'solid)) ) ;; This is the application specific callback ;; It is called whenever the frame needs repainting (define (draw-lines dc) (set! drawWidth (send canvas get-width)) (set! drawHeight (send canvas get-height)) ;Set the background color to lavender. (send dc set-background (make-object color% 220 200 255) ) (send dc clear) (send dc set-smoothing 'smoothed) (send dc set-pen red-pen) (send dc draw-line 0 0 drawWidth drawHeight) (send dc draw-line 0 drawHeight drawWidth 0) ) ;; Show the frame (send frame show #t) )) (lines 300 300)