Procedure to Tile a Bitmap on a TImage component.
Procedure to Tile a Bitmap on a TImage component.
procedure TForm1.BitBtn1Click(Sender: TObject);
procedure TileImage(Image:TImage;imagefile:string);
var
Bitmap: TBitmap;
X, Y, W, H: LongInt;
begin
Bitmap := TBitmap.Create;
Bitmap.LoadFromFile(imagefile);
with Bitmap do begin
W := Width;
H := Height;
end;
Y := 0;
while Y < Height do begin
X := 0;
while X < Width do begin
image.Canvas.Draw(X, Y, Bitmap);
Inc(X, W);
end;
Inc(Y, H);
end;
BitMap.free;
end;
begin
TileImage(image1,'H:\testproject\bg_title.bmp');
end;