使用Windows拖动复制光标 [英] Using the Windows Drag Copy cursor
问题描述
我可以这样设置光标:
Me.Cursor = Cursors.Cross
使用IntelliSense,我找不到此复制"光标:
有什么办法可以通过托管的方式获得它?我不想加载位图左右.我想把它留给Windows,因为用户可能已经更改了光标大小或设置了不同的颜色模式.
拖放光标属于 ole32.dll
.您可以从该库中加载它们.为此,您需要使用
[DllImport("kernel32.dll")]公共静态外部IntPtr LoadLibrary(string dllToLoad);[DllImport("user32.dll")]公共静态外部IntPtr LoadCursor(IntPtr hInstance,UInt16 lpCursorName);private void button1_Click(对象发送者,EventArgs e){var l = LoadLibrary("ole32.dll");var h = LoadCursor(l,6);this.Cursor = new Cursor(h);}
I can set a cursor like this:
Me.Cursor = Cursors.Cross
Using IntelliSense, I don't find this "Copy" cursor:
Is there any way to get it in a managed way? I wouldn't want to load a bitmap or so. I would like to leave that up to Windows as the user may have changed the cursor size or set a different color schema.
Drag and drop cursors belong ole32.dll
. You can load them from that library. To do so, you need to load ole32.dll
using LoadLibrary
, then using LoadCursor
get the handle of those cursors. You can use 1 to 7 as LoadCursor
parameter to get cursors from ole32.dll
. The cursor which you are looking for is 3
or 6
:
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("user32.dll")]
public static extern IntPtr LoadCursor(IntPtr hInstance, UInt16 lpCursorName);
private void button1_Click(object sender, EventArgs e)
{
var l = LoadLibrary("ole32.dll");
var h = LoadCursor(l, 6);
this.Cursor = new Cursor(h);
}
这篇关于使用Windows拖动复制光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!