以下是利用API中的BITBLT函數實現圖片的拷貝,但是我保留注釋的兩句就會報錯,注釋掉後不報錯但沒有任何效果,請問怎麼回事????
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
const
step=200;
var
bitmap:Tbitmap;
x0,y0:integer;
midx,midy:integer;
ratiox,ratioy:real;
i:integer;
begin
//hidebuttons(sender);
bitmap:=tbitmap.create;
bitmap.LoadFromFile('house.bmp');
ratiox:=bitmap.width/step;
ratioy:=bitmap.Height/step;
for i := 0 to step do
begin
bitblt(form1.canvas.handle,0,0,round(ratiox*i*1),round(ratioY*i*1),
bitmap.Canvas.Handle,0,0,srccopy);
bitmap.free;
//showbuttons(sender);
end;
end;
end.