如何使用API中的Polyline函数在任意个窗口上画线?(DC已知),最好有例子,谢谢(50分)

  • 主题发起人 主题发起人 小ゆ鱼ゆ儿
  • 开始时间 开始时间

小ゆ鱼ゆ儿

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