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;