Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change SystemParameters

Just a quick question: What exactly is the SystemParameters class? Is it just a collection of "default values" or is it actually kind of hooked into windows?

Background: For Drag&Drop operations we are using the SystemParameters.MinimumHorizontalDragDistance and SystemParameters.MinimumVerticalDragDistance properties to detect D&D. For Touch screens the default values are to small and I'm wondering if I have to implement some configuration mechanism to change this values or if I can change some system settings somewhere (lets say registry or control panel or whatever).

Thanks!

Update: With the detailed answer below I finally did find what I ws looking for. Just for reference if anybody else is looking for it in the future: The Minimum Drag Distance can be changed in the registry

HKEY_CURRENT_USER\Control Panel\Desktop\DragHeight
HKEY_CURRENT_USER\Control Panel\Desktop\DragWidth

By default both values are set to 4 (px). Be aware that the changes only take effect after reboot.

like image 205
harri Avatar asked Apr 28 '11 09:04

harri


1 Answers

It reflects the user's current settings, as specified in various places throughout Windows. Some settings are easily changed by the user in the Control Panel, and others are located in more obscure places like Registry values.

Ultimately, it is a managed wrapper around the GetSystemMetrics function from the Windows API.

The documentation provides more specific details on where it obtains each of the values exposed by properties. For example, the SystemParameters.MinimumHorizontalDragDistance property corresponds to the width of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins. Essentially, it's the "leeway" that the user is allowed to bump or jostle the cursor around before the system interprets their action as beginning a drag.

The documentation also tells you that it maps to SM_CXDRAG in the GetSystemMetrics function. So if you need even more detailed information, you can peruse the documentation for the native function, which tells you the following:

The number of pixels on either side of a mouse-down point that the mouse pointer can move before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation. If this value is negative, it is subtracted from the left of the mouse-down point and added to the right of it.

In short, it is definitely "hooked into Windows". This is the appropriate way to determine system settings, rather than hard-coding values that seemed desirable at development time. Your application should not expose its own configuration interface for things that the system already allows the user to configure; that's both redundant and confusing.

like image 99
Cody Gray Avatar answered Oct 18 '22 02:10

Cody Gray