MOUSE CURSORS
A form’s Cursor property determines the kind of mouse cursor the form displays. The Form class inherits the Cursor property from the Control class, so other controls have a Cursor property, too. If you want to give a particular control a special cursor, you can set its Cursor property. For example, if you use a Label control as a hyperlink, you could make it display a pointing hand similar to those displayed by web browsers to let the user know that the control is a hyperlink.
The Cursors class provides several standard cursors as shared values. For example, the following statement sets a form’s cursor to the system default cursor (normally an arrow pointing up and to the left):
Me.Cursor = Cursors.Default
Figure 9-2 shows example program ShowCursors, which is available for download on the book’s website, displaying the names and images of the standard cursors defined by the Cursors class in Windows 8. In other versions of Windows, some of the cursors may appear differently.
Unless a control explicitly sets its own cursor, it inherits the cursor of its container. If the control is placed directly on the form, it displays whatever cursor the form is currently displaying. That means you can set the cursor for a form and all of its controls in a single step by setting the form’s cursor.
Similarly, if a control ...
Get Visual Basic 2012 Programmer's Reference 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.