wforl
wforl

Reputation: 889

Change size of cursor "hittest" bounding area in WPF

Is it possible to increase the size of the point that is used for hit testing using the cursor in WPF?

I would like to be able to hit test with something similar to the entire area covered by the cursors image, as opposed to just a single point.

Im doing some line drawing that I need to recieve mouse events (enter/leave/etc), but having to align the cursor over small strokethicknesses can be tricky, and simply increasing the thickness isnt an option for me.

Upvotes: 2

Views: 591

Answers (1)

Nicholas W
Nicholas W

Reputation: 2241

One technique you can use here is to draw a second line or path with the same geometry and increased thickness, make it invisible and place it on top of the visible line. To do this set Stroke=Transparent, which will be invisible but still pick up mouse events.

This gives you control over the hit test area, admittedly with a little extra work on your part.

Upvotes: 1

Related Questions