将默认光标更改为自定义光标

时间:2020-08-21 17:00:40

标签: c# .net winforms

有什么简单的方法可以更改Windows窗体中的默认光标?

例如我想将C:\Program Files (x86)\The Kmplayer\PotPlayerMini64.exe更改为自定义光标。

当前使用的是这样的脏话:

Cursors.SizeWE

我也尝试在// https://github.com/dotnet/winforms/blob/07a7823865ef0409f34af626f75718c33b246781/src/System.Windows.Forms/src/System/Windows/Forms/Cursors.cs#L14 var propertyInfo = typeof(Cursors).GetField("s_sizeWE", BindingFlags.NonPublic | BindingFlags.Static); propertyInfo.SetValue(null, myCustomSizeWEcursor); 事件中更改它,但是它出现故障,有时仍然可以看到旧光标。

我不明白为什么它是只读的。

0 个答案:

没有答案