Draw cursor size fix

This commit is contained in:
Jaex 2015-03-06 17:33:27 +02:00
parent add9ff9493
commit e63cb67285
3 changed files with 37 additions and 1 deletions

View file

@ -102,7 +102,7 @@ public void DrawCursorToHandle(IntPtr hdcDest, Point cursorOffset)
if (IconHandle != IntPtr.Zero)
{
Point drawPosition = new Point(Position.X - cursorOffset.X, Position.Y - cursorOffset.Y);
NativeMethods.DrawIcon(hdcDest, drawPosition.X, drawPosition.Y, IconHandle);
NativeMethods.DrawIconEx(hdcDest, drawPosition.X, drawPosition.Y, IconHandle, 0, 0, 0, IntPtr.Zero, NativeMethods.DI_NORMAL);
}
}

View file

@ -46,5 +46,38 @@ public static partial class NativeMethods
public const int ULW_ALPHA = 0x02;
public const byte AC_SRC_OVER = 0x00;
public const byte AC_SRC_ALPHA = 0x01;
/// <summary>
/// Draws the icon or cursor using the mask.
/// </summary>
public const int DI_MASK = 0x0001;
/// <summary>
/// Draws the icon or cursor using the image.
/// </summary>
public const int DI_IMAGE = 0x0002;
/// <summary>
/// Combination of DI_IMAGE and DI_MASK.
/// </summary>
public const int DI_NORMAL = 0x0003;
/// <summary>
/// Draws the icon or cursor using the system default image rather than the user-specified image.
/// For more information, see About Cursors. Windows NT4.0 and later: This flag is ignored.
/// </summary>
public const int DI_COMPAT = 0x0004;
/// <summary>
/// Draws the icon or cursor using the width and height specified by the system metric values for cursors or icons,
/// if the cxWidth and cyWidth parameters are set to zero. If this flag is not specified and cxWidth and cyWidth are set to zero,
/// the function uses the actual resource size.
/// </summary>
public const int DI_DEFAULTSIZE = 0x0008;
/// <summary>
/// Windows XP: Draws the icon as an unmirrored icon. By default, the icon is drawn as a mirrored icon if hdc is mirrored.
/// </summary>
public const int DI_NOMIRROR = 0x0010;
}
}

View file

@ -76,6 +76,9 @@ public static partial class NativeMethods
[DllImport("user32.dll")]
public static extern bool DrawIcon(IntPtr hDC, int X, int Y, IntPtr hIcon);
[DllImport("user32.dll")]
public static extern bool DrawIconEx(IntPtr hdc, int xLeft, int yTop, IntPtr hIcon, int cxWidth, int cyHeight, int istepIfAniCur, IntPtr hbrFlickerFreeDraw, int diFlags);
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);