🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fj.lang.tcl
Article #196

[Q] I can't line precisely on canvas..

#196
From: Shigeki Ohira
Date: Fri, 07 Nov 1997 00:00
72 lines
3069 bytes
$B=i$a$FEj9F$7$^$9!#(B

$B8=:_!"BPOC%G!<%?J,(B$B@OMQ$N%D!<%k$r:n$C$F$$$k$N$G$9$,!"(B
$B$=$N5!G=$N0l$D$H$7$F!"0lDj6h4V$NIA2h(B(line)$B$H$=$N>e$X$N(B
$B%i%Y%kE=$j!"(B$B$H$$$&$b$N$r9M$($F$*$j$^$9!#(B

$BLdBj$J$N$O!"%9%/%m!<%k2DG=(B($B#xJ}8~(B)$B$J%-%c%s%P%9>e$N(B
$BG$0U$N#2E@!J$3$N#2E@(B$B$O8=:_I=<($5$l$F$$$kItJ,$K8B$k!K$r(B
$B%^%&%9$N:8%\%?%s$G%I%i%C%0$9$k$3$H$K$h$C$F$=$N5wN%$r(B
$B@~$G7k$V$H$$$&(B$BC1=c$J:n6H$K$b4X$o$i$:!"$&$^$/IA2h$5$l$J$$(B
$B$H$$$&$3$H$G$9!#(B
$B:G=i$N!"%9%/%m!<%k%P!<$,0lHV:8$K$"$k>uBV$G(B$B$OLdBj$"$j$^$;$s!#(B
$B%9%/%m!<%k%P!<Ey$rMQ$$$F1&J}8~$K%9%/%m!<%k$5$;$?>l9g!"(B
$B;OE@$,$O$k$+:8$NJ}$K$"$C$F=*(B$BE@$N$_@5>o0LCV$K%W%m%C%H$5$l$^$9!#(B

$B$3$NItJ,$O<!$N$h$&$J%W%m%0%i%`$K$J$C$F$*$j$^$9!#(B
$B?tCME*$K$O@5$7$$(B$BCM$rJV$7$F$*$j!"$=$N860x$,J,$+$j$^$;$s!#(B
$B$I$&$>!"$h$m$7$/$*4j$$$$$?$7$^$9!#(B
($B%W%m%0%i%`Cf$NJQ?t(B count $B$O!"(Bundo $BA`:n$N$b$N$G$9$N$G!"(B
 $B5$$K$7$J$$$G$/$@$5$$(B)

-----<from here>--------------------------
set work .frame.work
frame $work -relief raised
scrollbar $work.scroll -bd 2 -relief sunken -width 12 \
   -orient horizontal -command "$work.canvas xview"
set c1 $work.canvas
canvas $c1 -scrollregion {0c 0c 362c 26.2c} -width 22c -height 26.2c \
   -relief sunken -borderwidth 2 -xscrollcommand "$work.scroll set"

set count 1
set dx1($count) 0    ;### $B:BI8MQG[Ns$N=i4|@_Dj(B (dx1,dy1)-(dx2,dy2)
set dy1($count) 0
set dx2($count) 0
set dy2($count) 0 

bind $c1 <ButtonPress-1> "CanvB1Press $c1 %x %y"

proc CanvB1Press {sheet x y} {
  global dx1 dy1 dx2 dy2 count
  set c $sheet
  set sx [$c canvasx $x]
  set sy [$c canvasy $y]

  bind $c <ButtonRelease-1> "drawLine $c $x $y %x %y"
  proc drawLine {c sx sy cx cy} {
    global dx1 dy1 dx2 dy2 count
    set cx [$c canvasx $cx]
    $c create line $sx $sy $cx $sy -width 2 -fill red
    set dx1($count) $sx
    set dy1($count) $sy
    set dx2($count) $cx
    set dy2($count) $sy
    puts ($sx,$sy)-($cx,$sy) ;### $B3NG'=PNO(B
    incr count
  }
}

------<to here>-------------------------------------




--
    $B"i(B    $B"i(B   []=====================================[]
   $B"i(B$B!2(B  $B!2"i(B  []  $BAa0pEDBg3X(B $BM}9)3XIt(B $B>pJs3X2J#4G/(B   []
   $B"j"~(!"~($(B  [] $BCN<1>pJs9)3X@l96(B $BGr0f8&5f<<(B $B2;@<(B$BHI(B  []
   $B"j(B  $B"](B  $B"_(B  []      $BBgJ?(B $BLP51(B (Ohira Shigeki)      []
   $B"j!@"^!?"j(B  []E-mail:ohira@shirai.info.waseda.ac.jp[]
     $B!@!1!?(B    []=====================================[]       
       $B"w(B      
Technical Details
Message-ID: <G94P0211.97Nov8020730@wise21.mn.waseda.ac.jp>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS
X-Google-Thread: 15a83d,7659ec1e7f169b51,start
X-Google-Attributes: gid15a83d,public
From: g94p0211@mn.waseda.ac.jp (Shigeki Ohira)
Subject: [Q] I can't line precisely on canvas..
Date: 1997/11/07
Message-ID: <G94P0211.97Nov8020730@wise21.mn.waseda.ac.jp>
X-Deja-AN: 287707031
Distribution: fj
Organization: Centre for Informatics, WASEDA University
Newsgroups: fj.lang.tcl