Autor Beitrag
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: So 22.12.02 16:07 
Hi,
ich möchte auf ein TImage ein Teil von einem Screenshot kopieren. Und zwar ein Rechteck um der Maus.
Mir erscheint mein (Abgeändert von Swissdelphicenter) Code als völlig logisch, jedoch funktioniert er nicht.
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure ScreenShot(Bild: TBitMap);
var
  c: TCanvas;
  r: TRect;
begin
  c := TCanvas.Create;
  c.Handle := GetWindowDC(GetDesktopWindow);
  try
    r := Rect(Mouse.CursorPos.X - (Bild.Width div 2),
              Mouse.CursorPos.Y - (Bild.Height div 2),
              Mouse.CursorPos.X + (Bild.Width div 2),
              Mouse.CursorPos.Y + (Bild.Height div 2));
    Bild.Width  := Screen.Width;
    Bild.Height := Screen.Height;
    Bild.Canvas.CopyRect(r, c, r);
  finally
    ReleaseDC(0, c.Handle);
    c.Free;
  end;
end;


Aufgerufen wird das einem Timer:
ScreenShot(Image.Picture.Bitmap);
Alibi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: So 22.12.02 18:14 
Hat sich erledigt.