Delphi-Quellcode:
function MouseIn(rect: TRect): Boolean; overload;
function MouseIn(Ctrl: TControl): Boolean;
function MouseIn(rect: TRect): Boolean;
begin
Result := (Mouse.CursorPos.X >= rect.left) and (Mouse.CursorPos.X <= rect.right ) and
(Mouse.CursorPos.Y >= rect.top) and (Mouse.CursorPos.Y <= rect.bottom );
end;
function MouseIn(Ctrl: TControl): Boolean;
begin
Result := MouseIn(rect(Ctrl.ClientToScreen(0),Ctrl.ClientToScreen(0),Ctrl.ClientToScreen(Ctrl.Width),Ctrl.ClientToScreen(Ctrl.Height)));
end;
Sollte das nicht reichen? (ungetestet)
Lukas Erlacher
Suche Grafiktablett. Spenden/Gebrauchtangebote willkommen.
Gotteskrieger gesucht!
For it is the chief characteristic of the religion of science that it works. - Isaac Asimov, Foundation I, Buch 1