Oh, now that I re-read that code I see a bug: it needs to set the pen
back. So the last line of the procedure passed to dc should be:

  (send dc set-pen pen)

Robby

On Sat, May 26, 2012 at 11:03 AM, Jens Axel Søgaard
<[email protected]> wrote:
> 2012/5/26 Robby Findler <[email protected]>:
>> Oh, in that case, you could do this:
>>
>> (hc-append (blank 1 0) (hline (- w 1) 1))
>
> Thanks!
>
>> If you don't want the rounded edges, you'd have to do something like this:
>>
>> (define (fraction p q)
>>  (define w (max (pict-width p) (pict-width q)))
>>  (vc-append p (vc-append (blank 0 2) (butt-hline w)) q))
>>
>> (require racket/gui/base)
>> (define (butt-hline w)
>>  (dc
>>   (λ (dc dx dy)
>>     (define pen (send dc get-pen))
>>     (send dc set-pen (send the-pen-list find-or-create-pen
>>                            (send pen get-color)
>>                            (send pen get-width)
>>                            'solid
>>                            'butt))
>>     (send dc draw-line dx dy (+ dx w) dy))
>>   w 1))
>
> I think I can use this technique to make roots.
> And to make a proper "vector arrow".
>
> Thanks,
> Jens Axel

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to