1。在form上加上image.
2。在form1的private中加如下定义:
fclientinstance,fprevclientproc:tfarproc;
procedure clientwndproc(var message:tmessage);
procedure tform1.clientwndproc(var message:tmessage);
var
mydc:hdc;
ro,co:word;
begin
with message do
case msg of
wm-erasebkgnd:
begin
mydc:=twmreasebkgnd(message).dc;
for ro:=0 to clientheight div image1.picture.hight do
for co:=0 to clientwidth div image1.picture.width do
bitbtn(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,iparam);
end;
end;
在form1的create加
fclientinstance:=makeobjectinstance(clientwndproc);
fprevclientproc:=pointer(getwindowlong(clienthandle,gwl_wndproc);
setwindowlong(clienthandle,gwl_wndproc,longint(fclientinstance));