Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Maushöhe und Mausbreite abfragen... (https://www.delphipraxis.net/140471-maushoehe-und-mausbreite-abfragen.html)

Johannes013 18. Sep 2009 20:48


Maushöhe und Mausbreite abfragen...
 
Hallo,

ich habe ein Programm, dass Anweisungen immer von der Mausposition abhängig ausfürht. Ich kenne Mouse.CursorPos.X und so schon. Aber wie kann ich die Höhe und Breite des Cursors abfragen?

Dank im voraus!

Johannes013

hathor 18. Sep 2009 21:05

Re: Maushöhe und Mausbreite abfragen...
 
The hot spot of a cursor is the point to which Windows refers in tracking the cursor's position. By default, the hot spot is set to the upper-left corner of the cursor (coordinates 0,0). The Hotspot property in the Properties window shows the hot spot coordinates.

http://msdn.microsoft.com/en-us/libr...8VS.80%29.aspx

Delphi-Quellcode:
procedure TForm1.DrawCursor(bm : TBitmap; OffsetX, OffsetY : integer);
var
  cursorPos : TPoint;
  CursorInf: TCursorInfo;
  Icon: TIcon;
  IconInf: TIconInfo;
begin
  Icon := TIcon.Create;
  try
    CursorInf.cbSize := SizeOf(TCursorInfo);
    if GetCursorInfo(CursorInf) then
      if CursorInf.Flags = CURSOR_SHOWING then
      begin
        Icon.Handle := CursorInf.hCursor;
        if GetIconInfo(Icon.Handle, IconInf) then
            DrawIcon( bm.Canvas.Handle,
                      CursorInf.ptScreenPos.x - (IconInf.xHotspot + OffSetX),
                      CursorInf.ptScreenPos.y - (IconInf.yHotspot+ OffSetY),
                      Icon.Handle);
      end;
  finally
    Icon.Free;
  end;
end;

Johannes013 19. Sep 2009 13:00

Re: Maushöhe und Mausbreite abfragen...
 
Danke, jetzt hab ichs :D


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:22 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz