سؤال

I want to develop a custom cursor for a Windows Store App. I followed this tutorial and it worked great. The problem is that Windows only allow cursors to have a size of 32x32, and I need a bigger cursor.

I also tried the WPF code available here, but I cannot get the Microsoft.Win32.SafeHandles to work on my Store App project, so it did not work either...

So I thought about having a transparent canvas that filled all screen, on top of all visual elements. Then, I could set the mouse cursor to a transparent one (already done that), and then make an image follow the cursor position, thus replacing the cursor.

The problem with this solution is that now the canvas captures all the pointing events, and they don't get to the visual components underneath it. I tried setting the PointerRoutedEventArgs.Handled to false, but it does not work.

Any ideas on how I can solve this problem, or even another solution for having a bigger cursor on a Windows Store App?

هل كانت مفيدة؟

المحلول

I think the performance with a UIElement-based cursor might not be good enough, but if you really have to do that - you should

  1. Set IsHitTestVisible="False" on the Canvas
  2. Handle input events from Window.Current
  3. Use RenderTransform to move the cursor instead of setting Canvas.Left/Canvas.Top on the cursor element for better performance.
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top