procedure TForm1.ToolBar1CustomDraw(Sender: TToolBar; const ARect: TRect; var DefaultDraw: Boolean);
var
Bitmap: TBitmap;
I, J, W, H, BW, BH: Integer;
begin
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromFile('C:\WINNT\Coffee Bean.bmp');
BW := Bitmap.Width;
BH := Bitmap.Height;
with ARect do
begin
W := (Right - Left) div BW;
H := (Bottom - Top) div BH;
end;
for J := 0 to H do
for I := 0 to W do
Sender.Canvas.Draw(I * BW, J * BH, Bitmap);
finally
Bitmap.Free;
end;
end;