不是用直接用image中的位图,加mdi背景的代码dfw上有。要用自己的窗口处理函数
private
{ Private declarations }
FClientInstance,FPrevClientProc:TFarProc;
PROCEDURE ClientWndProc(VAR Message: TMessage);
......
procedure TMainForm.FormCreate(Sender: TObject);
begin
FClientInstance := Classes.MakeObjectInstance(ClientWndProc);
FPrevClientProc := Pointer(GetWindowLong(ClientHandle, GWL_WNDPROC));
SetWindowLong(ClientHandle, GWL_WNDPROC, LongInt(FClientInstance));
end;
procedure TMainForm.ClientWndProc(var Message: TMessage);
var MyDC : hDC;
begin
with Message do
case Msg of
WM_ERASEBKGND:
begin
MyDC := TWMEraseBkGnd(Message).DC;
StretchBlt(MyDC,
0 , 0 , ClientWidth , ClientHeight ,
Image2.Picture.Bitmap.canvas.Handle ,
0, 0 ,Image2.Picture.Width, Image2.Picture.Height,
SRCCOPY);
Result := 1;
end;
WM_PAINT:begin
InvalidateRect(CLientHandle,nil,True);
Message.Result:=CallWindowProc(FPrevClientProc,ClientHandle,Message.Msg,Message.WParam,Message.LParam);
Result :=0;
end;
else
Result := CallWindowProc(FPrevClientProc, ClientHandle, Msg, wParam, lParam);
end;
end;