Hey, I've been trying to write code that loads a .png file, attaches hotspot information, and saves it to a .cur file.
So far I have code to create a System.Windows.Forms.Cursor object, which I'll post below:
Bitmap bmp = new Bitmap(source_image);
IconInfo inf = new IconInfo();
GetIconInfo(bmp.GetHicon(), ref inf);
inf.xHotspot = /* code to get x hotspot */;
inf.yHotspot = /* code to get y hotspot */;
inf.fIcon = false;
IntPtr iconPtr = CreateIconIndirect(ref inf);
return new Cursor(iconPtr);
I took it directly from this tutorial.
I've gotten the cursor to work properly within my application, there just seems to be no way to save it to a file. Any help guys?