1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| Pour texturer le fond d'une fenêtre MDI mêre (Image1 contient la texture) :
Code:
[...]
private
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
DC: HDC;
i, j: Word;
begin
with Message do
case Msg of
WM_ERASEBKGND: begin
DC:= TWMEraseBkGnd(Message).DC;
for j:= 0 to ClientHeight div Image1.Picture.Height do
for i:= 0 to ClientWidth div Image1.Picture.Width do
with Image1.Picture do
BitBlt(DC, i* Width, j* Height, Width, Height, Bitmap.Canvas.Handle, 0, 0, SRCCOPY);
Result:= 1;
end;
else
Result:= CallWindowProc(FPrevClientProc, ClientHandle, Msg, wParam, lParam);
end;
end;
[...] |
Partager