procedure TForm1.FormPaint(Sender: TObject); var w,h,x,y,i,j:integer; rect1,rect2:Trect; tmp:TBitMap; begin tmp:=Tbitmap.Create; tmp.LoadFromFile('D:\祝海钢\练习\rect\1.bmp'); w:=tmp.Width; h:=tmp.Height; x:=0; y:=0; for i:=0 to (Form1.Height div h + 1) do begin x:=0; for j:=0 to (Form1.Width div w +1) do begin Rect1 := Rect(x,y,x+w,y+h); Rect2 := Rect(0,0,w,h); Form1.Canvas.CopyRect(Rect1,tmp.Canvas,Rect2); x:=x+w; end; y:=y+h; end; tmp.Free; end; 注意:该方法不能用于MDIForm
如Canvas.CopyRect等,应该够用了。
在onpaint中画画。
var
w,h,x,y,i,j:integer;
rect1,rect2:Trect;
tmp:TBitMap;
begin
tmp:=Tbitmap.Create;
tmp.LoadFromFile('D:\祝海钢\练习\rect\1.bmp');
w:=tmp.Width;
h:=tmp.Height;
x:=0;
y:=0;
for i:=0 to (Form1.Height div h + 1) do
begin
x:=0;
for j:=0 to (Form1.Width div w +1) do
begin
Rect1 := Rect(x,y,x+w,y+h);
Rect2 := Rect(0,0,w,h);
Form1.Canvas.CopyRect(Rect1,tmp.Canvas,Rect2);
x:=x+w;
end;
y:=y+h;
end;
tmp.Free;
end;
注意:该方法不能用于MDIForm