0

I'm using a custom cursor that I loaded in this way:

Bitmap bit = new Bitmap(path);
cur = new Cursor(bit.GetHicon());
Cursor.current = cur;

my bitmap is a 44x58 png and the mouse hot spot is not exactly where I want to be. I looked for a property to change the mouse hot spot but the only one I found is readable-only (cur.Hotspot). What I need to do for change its coordinates?

Thanks

animuson
  • 52,378
  • 28
  • 138
  • 145
Frank Lioty
  • 869
  • 3
  • 10
  • 17
  • Does that help? http://stackoverflow.com/questions/550918/change-cursor-hotspot-in-winforms-net – Otiel Jul 17 '12 at 15:59
  • 1
    Duplicate of http://stackoverflow.com/questions/550918/change-cursor-hotspot-in-winforms-net as pointed out by @Otiel – Ani Jul 17 '12 at 16:00
  • @ananthonline all I need is to change also offline my hot spot. Also ok with a software or something similar. – Frank Lioty Jul 17 '12 at 17:50

2 Answers2

0

In Visual Studio, open the cursor file or resource in the image editor and select the Hotspot Tool from the toolbar. Then click on the new hotspot and save the file. AFAIK there is no way to set the hotspot via the .NET API, but there are options via the WIN32 API, as demonstrated in the links in the others' comments.

-2

At the end I simply decide to hide the mouse cursor and draw a bitmap at the hotspot coordinates. Too much complicated the solution suggested.

cursor = new Bitmap(path);

in MouseMove event:

ex = e.X - offx //the x offset of the hotspot
ex = e.X - offy //the y offset of the hotspot

then paint as last drawing element the bitmap at the (ex,ey) coordinates.

Frank Lioty
  • 869
  • 3
  • 10
  • 17