SystemInformation Properties

Strictly speaking, it is not necessary to have a mouse or other pointing device installed on a Windows system, although as a practical matter, it is difficult to work with Windows without one, and virtually every modern Windows computer has a mouse or pointer installed. The SystemInformation class provides several read-only static (Shared in VB.NET) properties, listed in Table 8-1, which allow a program to determine if a mouse is connected to the system, and if so, the configuration and capabilities of the mouse. Accessing these properties is demonstrated in the programs listed in Example 8-1 (in C#) and in Example 8-2 (in VB.NET).

Most mice in use today on Windows systems have two buttons: the left button is typically the primary button and the right button is typically the secondary button. The user can swap these preferences in the Control Panel/Mouse applet to allow left-handed users to reverse the buttons. If the primary button is clicked twice in rapid succession without moving more than a certain number of pixels, the action is interpreted as a double-click. Many mice today also have a mouse wheel, which can also be seen by the system as a third button. The last three properties listed in Table 8-1 relate to the wheel.

Table 8-1. SystemInformation mouse properties

Property

Type

Description

DoubleClickSize

Size

Returns dimensions, in pixels, of rectangular area around the first mouse click within which two mouse clicks can be considered a double-click. ...

Get Programming .NET Windows Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.