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
|
w:=320;
h:=240;
s:=10;
x:=mouse.CursorPos.X;
y:=mouse.CursorPos.Y;
with rs do
begin
Left := x - ((w div s) div 2);
Right := x + ((w div s) div 2);
Top := y - ((h div s) div 2);
Bottom := y + ((h div s) div 2);
end;
with rd do
begin
Left := x - (w div 2);
Right := x + (w div 2);
Top := y - (h div 2);
Bottom := y + (h div 2);
end;
bmp := TBitmap.Create;
bmp.LoadFromFile('e:\01.bmp');
bmp.Width:=w;
bmp.Height:=h;
dsk := TCanvas.Create;
dsk.Handle := GetDC(0);
bmp.Canvas.CopyRect(Rect(0,0,w,h), dsk, rd);
dsk.CopyRect(rd, dsk, rs);
dsk.Draw(x - (w div 2), y - (h div 2), bmp);
ReleaseDC(0, dsk.Handle);
dsk.Free;
bmp.Free; |
Partager