比较简单,如下:
var
fclientinstance,fprevclientproc:tfarproc;
procedure tform1.clientwndproc(var message:tmessage);
var mydc:hdc; ro,co:word;
begin
with message do
case msg of
WM_ERASEBKGND:
begin
mydc:=TWMEraseBKGND(message).DC;
for ro:=0 to clientheight div image1.picture.height do
for co:=0 to clientwidth div image1.picture.width do
bitblt(mydc,co*image1.picture.width,ro*image1.picture.height,
image1.picture.width,image1.picture.height,image1.picture.bitmap.canvas.handle,0,0,srccopy);
result:=1;
end
else result:=callwindowproc(fprevclientproc,clienthandle,msg,wparam,lparam);
end;
end;
procedure Tform1.FormActivate(Sender: TObject);
begin
fclientinstance:=makeobjectinstance(clientwndproc);
fprevclientproc:=pointer(getwindowlong(clienthandle,GWL_WNDPROC));
setwindowlong(clienthandle,GWL_WNDPROC,longint(fclientinstance));
end;