silviodp
23-12-2004, 23:34:13
Como se puede poner una imagen de fondo en un formulario MDI en Delphi 7? Es decir en formulario principal de una aplicación.
Gracias, saludos.-
Silvio.-
ArdiIIa
24-12-2004, 12:05:45
Te pongo un ejemplo...
Espero que te sirva y FLIZ NAVIDAD !! :)
......
private
FClientInstance : TFarProc;
FPrevClientProc : TFarProc;
procedure ClientWndProc(var Message: TMessage);
...
procedure TFormMain.FormCreate(Sender: TObject);
begin
FClientInstance := MakeObjectInstance(ClientWndProc);
FPrevClientProc := Pointer(GetWindowLong(ClientHandle,GWL_WNDPROC));
SetWindowLong(ClientHandle,GWL_WNDPROC, LongInt(FClientInstance));
end;
procedure TFormMain.ClientWndProc(var Message: TMessage);
var
Dc : hDC;
Row,col: Integer;
Bit : TBitmap;
begin
with Message do
case Msg of
WM_ERASEBKGND:
begin
DC := TWMEraseBkGnd(Message).Dc;
begin
Bit := TBitmap.Create;
Bit.Width := Image1.Width;
Bit.Height := Image1.Height;
Bit.Canvas.Draw(0,0,Image1.Picture.Graphic);
for Row := 0 to ClientHeight div Bit.Height do
for Col := 0 to ClientWidth div Bit.Width do
BitBlt(Dc,
Col * Bit.Width,
Row * Bit.Height,
Bit.Width,
Bit.Height,
Bit.Canvas.Handle,
0,
0,
SRCCOPY);
Result := 1;
Bit.Free;
End;
Result := 1;
end;
else
Result := CallWindowProc(FPrevClientProc,
ClientHandle,
Msg,
wParam,
lParam);
end;
end;
procedure TFormMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
SetWindowLong(ClientHandle,GWL_WNDPROC, LongInt(FPrevClientProc));
end;
vBulletin v3.6.8, Derechos ©2000-2024, Jelsoft Enterprises Ltd.