在MDI主窗体上放一个Image,载入一个ico:
设定Image1.Align :=alClient;
Form1.FormStyle :=fsMDIForm;
private
{ Private declarations }
FClientInstance,
FPrevClientProc : TFarProc;
procedure ClientWndProc(VAR Message: TMessage);
procedure TMainForm.FormCreate(Sender: TObject);
begin
FClientInstance := MakeObjectInstance(ClientWndProc);
FPrevClientProc := Pointer(GetWindowLong(ClientHandle, GWL_WNDPROC));
SetWindowLong(ClientHandle, GWL_WNDPROC, LongInt(FClientInstance));
end;
procedure TMainForm.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;