tags:

views:

184

answers:

1

I'm having amazing difficulties with a high-precision pixel-oriented image program in WPF and starting to suspect that the Cursors.Cross cursor hotspot is not at its centre, as you would expect.

I'm debugging using Magnifier at 16x and mouse set to the lowest acceleration. The code is based on DrawTools from CodeProject.

image captured from Magnifier

Is this the same cursor as you get in Winforms? If so, I can look at that cursor's hotspot - the Cursor class in System.Windows.Input doesn't have the HotSpot property.

UPDATE

In case anyone is looking for a workaround, in my case I already have a delegate being invoked to filter the points so I can implement snap-to-grid behaviour. It was trivial to offset the point by 1 to compensate. This was a lot easier than creating a custom cursor and has the advantage that I'm still using the stock cursor if its appearance should change.

+2  A: 

I have an empirical answer that yes, the hotspot is offset.

I modified the program to be able to trigger graphics modes by pressing keys, so you don't need to move the mouse.

Using the same Magnifier view as the snapshot above, just pressing a key to change the mode toggles the cursor between arrow and cross.

When I switch it draws the cursor so the black lines centre on the top-left point of the normal arrow cursor.

The arrow cursor hotspot is at the pixel it points to (not a black pixel) so yes, the cross cursor hotspot is NOT at the centre of the crosshairs!

sigh

Andy Dent