FClientInstance, FPrevClientProc : TFarProc;
procedure ClientWndProc(var Message: TMessage);
//定义变量与过程
procedure TForm1.FormCreate(Sender: TObject);
begin
FClientInstance:= MakeObjectInstance(ClientWndProc);
FPrevClientProc:= Pointer(GetWindowLong(ClientHandle, GWL_WNDPROC));
SetWindowLong(ClientHandle, GWL_WNDPROC, LongInt(FClientInstance));
end;
procedure TForm1.ClientWndProc(var Message: TMessage);
var
MyDC:hDC;
Ro,Co:Word;
begin //在窗体上画背景
if message.Msg<>WM_ERASEBKGND then begin
message.Result := CallWindowProc(FPrevClientProc,ClientHandle, message.Msg,message.wParam,message.lParam);
exit;
end;
MyDC := TWMEraseBkGnd(Message).DC;
for Ro := 0 to ClientHeight div Image1.Picture.Height do begin
for Co := 0 TO ClientWIDTH div Image1.Picture.Width do begin
BitBlt(MyDC, Co*Image1.Picture.Width, Ro*Image1.Picture.Height,
Image1.Picture.Width, Image1.Picture.Height,
Image1.Picture.Bitmap.Canvas.Handle, 0, 0, SRCCOPY);
message.Result:= 1;
end;
end;
end;
加分吧!!!!!