伙计们,我有一个 C# Winforms 应用程序,在表单中有一个面板。我想做的是,每当鼠标指针进入这个面板时,我想将鼠标的移动速度减慢 50%。一旦指针移出此面板,我希望鼠标速度恢复正常的 100% 速度。我如何在 C# 中完成此操作?
最佳答案
This文章可能有帮助
这是文章中的代码:
using System;
using System.Runtime.InteropServices;
namespace MouseSpeedSwitcher
{
class Program
{
public const UInt32 SPI_SETMOUSESPEED = 0x0071;
[DllImport("User32.dll")]
static extern Boolean SystemParametersInfo(
UInt32 uiAction,
UInt32 uiParam,
UInt32 pvParam,
UInt32 fWinIni);
static void Main(string[] args)
{
SystemParametersInfo(
SPI_SETMOUSESPEED,
0,
uint.Parse(args[0]),
0);
}
}
}
关于c# - 动态改变鼠标速度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2931122/