#5055: Workaround to fix hotspot with bigger cursor sizes

This commit is contained in:
Jaex 2022-06-14 22:48:50 +03:00
parent 8984913049
commit 85d8d24467

View file

@ -65,7 +65,14 @@ public void UpdateCursorData()
{ {
if (NativeMethods.GetIconInfo(iconHandle, out IconInfo iconInfo)) if (NativeMethods.GetIconInfo(iconHandle, out IconInfo iconInfo))
{ {
Position = new Point(Position.X - iconInfo.xHotspot, Position.Y - iconInfo.yHotspot); if (Size.IsEmpty)
{
Position = new Point(Position.X - iconInfo.xHotspot, Position.Y - iconInfo.yHotspot);
}
else
{
Position = new Point(Position.X - iconInfo.xHotspot * (Size.Width / 32), Position.Y - iconInfo.yHotspot * (Size.Height / 32));
}
if (iconInfo.hbmMask != IntPtr.Zero) if (iconInfo.hbmMask != IntPtr.Zero)
{ {
@ -111,6 +118,8 @@ public void DrawCursor(Image img, Point offset)
IntPtr hdcDest = g.GetHdc(); IntPtr hdcDest = g.GetHdc();
DrawCursor(hdcDest, offset); DrawCursor(hdcDest, offset);
g.ReleaseHdc(hdcDest);
} }
} }
} }