I did not find an API to set it, but we can do it by modifying the registry.
Computer\HKEY_CURRENT_USER\Control Panel\Desktop
RegistryKey myKey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
if (myKey != null)
{
myKey.SetValue("MouseWheelRouting",2);
myKey.Close();
}
textBox1.Text = GetValue().ToString();
A value of 2 means on, and a value of 0 means off.
Two things need to be noted. One is that modifying the registry requires administrator rights, and the other is that the modification of the registry requires restarting the computer to take effect.
To prevent unnecessary troubles, before modifying the registry, I suggest you back up it first.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.