D
ddev
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);<br>const<br> POINT_COUNT = 6;<br>var<br> pts: array of TPoint;<br> hpn: HPEN;<br>begin<br> SetLength(pts, POINT_COUNT);<br><br> pts[0] := Point(10, 10);<br> pts[1] := Point(100, 10);<br> pts[2] := Point(100, 20);<br> pts[3] := Point(10, 20);<br> pts[4] := Point(10, 30);<br> pts[5] := Point(100, 30);<br> <br> hpn := GetStockObject(BLACK_PEN);<br> SelectObject(Canvas.Handle, hpn);<br> PolyLine(Canvas.Handle, pts, POINT_COUNT);<br> DeleteObject(hpn);<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>const<br> POINT_COUNT = 6;<br>var<br> pts: array[0..POINT_COUNT - 1] of TPoint;<br> hpn: HPEN;<br>begin<br> pts[0] := Point(10, 10);<br> pts[1] := Point(100, 10);<br> pts[2] := Point(100, 20);<br> pts[3] := Point(10, 20);<br> pts[4] := Point(10, 30);<br> pts[5] := Point(100, 30);<br><br> hpn := GetStockObject(BLACK_PEN);<br> SelectObject(Canvas.Handle, hpn);<br> PolyLine(Canvas.Handle, pts, POINT_COUNT); <br> DeleteObject(hpn);<br>end;<br><br>第二个函数能够正常处理,但第一个函数却不能:why?