通过下列程序实现双击窗体的OnPaint事件,然后编写如下
程序: procedure TForm1.FormPaint(Sender: TObject);
var i:word; dy,y:real;
begin
dy:=clientheight/256;
y:=0;
for i:=255 downto 0 do begin canvas.brush.color:=$00000000+i*$10000;
canvas.fillrect(rect(0,round(y),clientwidth,round(y+dy))); y:=y+dy;
end;
end;