public static Cursor CreateCursor( Bitmap bmp, int xHotSpot, int yHotSpot, float scalingFactor) { int width = (int)(32.0 * (double)scalingFactor); int height = (int)(32.0 * (double)scalingFactor); using (Bitmap bitmap = new Bitmap((Image)bmp, width, height)) { IntPtr hicon = bitmap.GetHicon(); IconInfo icon = new IconInfo(); ref IconInfo local = ref icon; InteropWindow.GetIconInfo(hicon, ref local); icon.xHotspot = (int)((double)xHotSpot * (double)scalingFactor * ((double)width / (double)bmp?.Width.Value)); icon.yHotspot = (int)((double)yHotSpot * (double)scalingFactor * ((double)height / (double)bmp?.Height.Value)); icon.fIcon = false; return(new Cursor(InteropWindow.CreateIconIndirect(ref icon))); }