cursor personalizado en la aplicación metro

I am developing a paint like application. I want to change cursor at some instance. So, how can I use the custom cursor in metro app ?

He encontrado esto

Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Custom, uint id);

In above method, there is one enum for "Custom" cursor and the second argument is for resource ID. So how can I get that ?

preguntado el 04 de julio de 12 a las 10:07

1 Respuestas

The basic route to doing this:

Create your custom cursor and package it in a .res using a C++ Metro DLL Take a note of your resource id by peeking into the resource.h file in the C++ project In my project the resource number was 101 and I didn't adjust. Add the .res to a CSharp XAML Metro project Open your .csproj using a text editor Inside the first property group add a section that points to your .res file Switch out the cursor to the custom cursor using the function call you referenced, and the resource number you found by peeking at resource.h. Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Custom, 101);

I realize this is a lot. I posted a detailed step by step walk through on my blog at http://blogs.msdn.com/b/devfish/archive/2012/08/02/customcursors-in-windows-8-csharp-metro-applications.aspx . Espero que esto ayude.

Respondido 02 ago 12, 02:08

I followed the specified instructions with RTM bits in march, 2013 and I still get an InvalidArgumentException thrown for the specified ID. - greg d

Important note: Do no trust autocomplete when editing the csproj file. It will try to use the "Win32ResourceFile" tag. THAT IS INCORRECT. Use "Win32Resource". - greg d

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.