问题终于解决,代码如下,在这里对cheylin兄表示十二万分的感谢!!!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, jpeg, ExtCtrls;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
FileF1: TMenuItem;
EditE1: TMenuItem;
Open1: TMenuItem;
New1: TMenuItem;
Close1: TMenuItem;
N1: TMenuItem;
Exit1: TMenuItem;
Image1: TImage;
Image2: TImage;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
//below 3 lines to display a picture on the MDI client
FClientInstance : TFarProc;
FPrevClientProc : TFarProc;
procedure ClientWndProc(var Message: TMessage);
public
{ Public declarations }
end;
var
Form1: TForm1;
Dc : hDC;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.ClientWndProc(var Message: TMessage);
var
Dc : hDC;
Row : Integer;
Col : Integer;
begin
with Message do
if (Msg = WM_PAINT) or (Msg = WM_ERASEBKGND) then
begin
Dc := TWMEraseBkGnd(Message).Dc;
for Row := 0 to ClientHeight div Image1.Picture.Height do
for Col := 0 to ClientWidth div Image1.Picture.Width do
BitBlt(Dc,
Col * Image1.Picture.Width,
Row * Image1.Picture.Height,
Image1.Picture.Width,
Image1.Picture.Height,
Image1.Picture.Bitmap.Canvas.Handle,
0,
0,
SRCCOPY);
Result := 1;
BitBlt(Dc,
ClientWidth - Image2.Picture.Width, //¾ßÌåµÄLeft×Ô¼ºµ÷Õû°É
ClientHeight - Image2.Picture.Height, //¾ßÌåµÄTop×Ô¼ºµ÷Õû°É
Image2.Picture.Width,
Image2.Picture.Height,
Image2.Picture.Bitmap.Canvas.Handle,
0,
0,
SRCCOPY);
end
else
Result := CallWindowProc(FPrevClientProc,
ClientHandle,
Msg,
wParam,
lParam);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FClientInstance := MakeObjectInstance(ClientWndProc);
FPrevClientProc := Pointer(GetWindowLong(ClientHandle,GWL_WNDPROC));
SetWindowLong(ClientHandle, GWL_WNDPROC, LongInt(FClientInstance));
end;
end.