custom cursor in metro app

左心房为你撑大大i 提交于 2019-12-19 04:20:07

问题


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 ?

I have found this

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 ?


回答1:


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 . Hope this helps.



来源:https://stackoverflow.com/questions/11326026/custom-cursor-in-metro-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!