参照下面的代码就行,关键在CustomDraw事件重
procedure TForm1.TreeView1CustomDraw(Sender: TCustomTreeView;
const ARect: TRect; var DefaultDraw: Boolean);
var
x,y,w,h : LongInt;
Bitmap1: TBitmap;
begin
Bitmap1 := TBitmap.Create;
Bitmap1.LoadFromFile('backgray.bmp');
with Bitmap1 do begin
W := Width;
H := Height;
end;
Y := 0;
while Y < Height do begin
X := 0;
while X < Width do begin
treeView1.Canvas.Draw(X,Y,Bitmap1);
Inc(X,W);
end;
Inc(Y,H);
end;
end;