Dynamically changing Mouse speed

前端 未结 2 718
情深已故
情深已故 2020-12-11 16:06

Guys, I have a C# Winforms application with a panel inside the form. What I want to do is, whenever the mouse pointer enters this panel, I want to slow the movement speed of

2条回答
  •  半阙折子戏
    2020-12-11 16:17

    This article might help

    Here's the code from the article:

    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);
            }
        }
    }
    

提交回复
热议问题