本文介绍了我怎样才能改变光标(图像)在整个Windows操作系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要改变光标在所有的窗口,不只是在应用程序中,我有尝试这个办法:
I need to change the cursor in all windows, not just in the application, i have try this:
this.Cursor = Cursors.WaitCursor;
和这样的:
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
但它只会改变光标在我的应用程序。
But it only changes the cursor in my application.
你知道吗?
推荐答案
假设你有你自己的光标文件(.CUR)申请,你可以破解这个。
Assuming you have your own cursor file (.cur) to apply you could hack this.
首先,你将不得不改变thje默认的箭头光标在注册表中,那么你就需要调用一些P-Invoke来允许操作系统更新当前系统正paramerters所以光标实际上改变。
First you will have to change thje default Arrow cursor in the Registry, then you will need to call some P-Invoke to allow the OS to update the current sytem paramerters so the cursor actually changes.
财产以后这样的:
private void ChangeCursor(string curFile)
{
Registry.SetValue(@"HKEY_CURRENT_USER\Control Panel\Cursors\", "Arrow", curFile);
SystemParametersInfo(SPI_SETCURSORS, 0, null, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
}
const int SPI_SETCURSORS = 0x0057;
const int SPIF_UPDATEINIFILE = 0x01;
const int SPIF_SENDCHANGE = 0x02;
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint? pvParam, uint fWinIni);
用法:
ChangeCursor(@"C:\MyCursor.cur");
这篇关于我怎样才能改变光标(图像)在整个Windows操作系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!