Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom mouse cursor size in WPF

We are developing an application that must be used by people that may have some visual problem involving the use of kinect to move the cursor, so we need to make it bigger than usual. However, this application does not interfaces directly with kinect, so we can't use its APIs.

We are programming in C# (.NET 4.5) using WPF. The problem is that the default cursor size cannot be bigger than 32x32 pixel or 64x64 pixel in high res devices.

We first tried to make the actual mouse cursor invisible and then use a Graphics object, taken using Graphics.FromHwnd(applicationWindowHandler). It succeeds to draw the image but it leaves the trail of the past cursor positions.

Is there a way to do using the regular windows mouse cursor, or at least a way to remove the trail (like an "invalidate" method that force the current window to refresh)?

We already tried these solutions but with no luck:

www.hsys.com/CustomCursorArticlePart1.htm

www.hsys.com/CustomCursorArticlePart2.htm

csharparticles.blogspot.it/2005/03/custom-drawing-cursors.html

like image 573
breathe0 Avatar asked Sep 11 '13 13:09

breathe0


1 Answers

Couldn't you just use a Canvas control that covers the entire window, set the cursor to none and then put an Image control with a suitably large cursor image in the Canvas, with its Left and Top properties bound to the cursor's X and Y coordinates relative to the Canvas??

like image 166
Bas Avatar answered Sep 20 '22 12:09

Bas