如何在使用Windows窗体应用程序时将鼠标光标更改为自定义光标? [英] How to change the mouse cursor into a custom one when working with Windows Forms applications?
问题描述
在 UserControl
中,我想将鼠标光标从箭头更改为手形图标。
我当前所做的是: / p>
this.Cursor = Cursors.Hand;
这是非常好的,它给我一个鼠标光标如下:
但这里有我的问题...这显示了一个手指指向手指。
我需要的是一个抓取手,更像这样:
>
如何做到这一点?如何加载图标文件(.ico),光标文件(.cur)或图像文件(.png),并将其用作鼠标光标?
如果您有光标文件:
Cursor myCursor = new Cursor(myCursor.cur);
myControl.Cursor = myCursor;
否则必须创建一个:
有关自定义光标的一些详细信息 p>
In a UserControl
I want to change the mouse cursor from the arrow, to a hand icon.
What I currently do is this:
this.Cursor = Cursors.Hand;
This is very nice, it gives me a mouse cursor looking like this:
But here comes my problem... this shows a hand with a pointing finger.
What I need is a "grabbing" hand, more like this one:
How do I do this?, How can I load an icon file (.ico), a cursor file (.cur), or image file (.png), and use it as the mouse cursor?
If you have a cursor file:
Cursor myCursor = new Cursor("myCursor.cur");
myControl.Cursor = myCursor;
otherwise you have to create one:
some more information about custom cursors
这篇关于如何在使用Windows窗体应用程序时将鼠标光标更改为自定义光标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!