开发者

Using custom cursor in C#

开发者 https://www.devze.com 2023-01-05 05:32 出处:网络
Let\'s say I have a cursor named myCur.cur.What I would like to 开发者_JS百科do is use that cursor on my desktop application instead of the boring cursor provided by Visual Studio 2005.How do I write

Let's say I have a cursor named myCur.cur. What I would like to 开发者_JS百科do is use that cursor on my desktop application instead of the boring cursor provided by Visual Studio 2005. How do I write for that?


If you're targeting WinForms, load a cursor file (the one with the ".cur" extension) that you created

Cursor myCursor = new Cursor("myCursor.cur");

then assign it as the cursor on any of your controls:

myControl.Cursor = myCursor;

For additional information on how to do more than this, and create your cursor programmatically instead of loading it from a file, then check out this tutorial.

Should you be or become interested in how to do this in WPF, there's also an article to this regard.

0

精彩评论

暂无评论...
验证码 换一张
取 消