看一看给你的源代码:<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br> procedure FormCreate(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br> points:array[0..20]of Tpoint;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> polyline(canvas.handle,points,21); //把这里的canvas.handle用你的DC的handle代替就行了!<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>var<br> i:integer;<br>begin<br> for i:=0 to 20 do<br> begin<br> points.x:=i*20;<br> points.y:=150+random(100);<br> end;<br>end;<br><br>end.<br>