在Metro应用程序定义光标 [英] custom cursor in metro app

查看:183
本文介绍了在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 ?

我发现这个

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

在上述方法中,有一个自定义光标和第二数提供一个枚举资源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 ?

推荐答案

要这样做的基本路线:

创建自定义光标和使用C ++地铁DLL
。通过偷看在C ++项目
Resource.h文件在我的项目采取记下自己的资源ID的一个.RES打包资源数量是101,我没有调整。
添加.RES到CSHARP XAML新城项目
使用文本编辑器
在第一组里面打开你的.csproj添加指向您的res文件,
开关一节出光标,使用你所引用的函数调用自定义光标和资源数量,你通过偷看RESOURCE.H发现。
Window.Current.CoreWindow.PointerCursor =新Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Custom,101);

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);

我意识到这是一个不少。我张贴了详细的一步一步的 http://blogs.msdn.com/b/devfish/archive/2012/08/02/customcursors-in-windows-8-csharp-metro-applications.aspx 。希望这有助于。

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.

这篇关于在Metro应用程序定义光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆