MousePointer Property

See Also3ITLTBE                 Example12720G8>Low

Applies To

Form14TJ2LN, check box9P3BU5, combo box1YZXFF6, command buttonXJSPC0, data control2E1FEX3, directory list boxO9U5A0, drive list box5WJO0PW, file list box1M6S8UX, frame1KX6ZP8, horizontal scroll bar1JSJOS7, image9A4FCA, label3MNIZ8D, list boxG11UCK, option buttonJYBO08, picture box31MYIWX, Screen object1052P0, text boxYPYZDG, vertical scroll bar1JSJOS7.

Description

Determines the type of mouse pointer displayed when the mouse is over a particular part of a form or control at run time.

Usage

{ [form.][control.]|Screen.}MousePointer[ = setting ]

Setting

The MousePointer property settings are:

Setting             Description

 

0                      (Default) Shape determined by the control

1                      Arrow

2                      Cross (cross-hair pointer)

3                      I-Beam

4                      Icon (small square within a square)

5                      Size (four-pointed arrow pointing north, south, east, west)

6                      Size NE SW (double arrow pointing northeast and southwest)

7                      Size N S (double arrow pointing north and south)

8                      Size NW SE (double arrow pointing northwest and southeast)

9                      Size W E (double arrow pointing west and east)

10                    Up Arrow

11                    Hourglass (wait)

12                    No Drop

 

Remarks

The MousePointer property controls the shape of the mouse pointer.  This property is useful when you want to indicate changes in functionality as the mouse pointer passes over controls on a form or dialog box.  The Hourglass setting (11) is useful for indicating that the user should wait for a process or operation to finish.

 

Note   When set for the Screen object, MousePointer changes across the entire screen; that is, it overrides all MousePointer settings for other objects and other applications.  Setting MousePointer to 0 (default) restores the previous behavior.

 

Data Type

IntegerDOKXHY


See Also

Help:

DragIcon Property3G3M07O

MouseMove Event1D70SW5

 

Programmer's Guide:

Chapter 12, "Responding to Mouse Events"


MousePointer Property Example

The example changes the pointer to an hourglass while circles are drawn across your screen, and then changes the hourglass back to a pointer at the end of the procedure.  To try this example, paste the code into the Declarations section of a form.  Press F5 to run the program and then click the form.

Sub Form_Click ()
  Dim I                                 ' Declare variable.
  Screen.MousePointer = 11              ' Change pointer to hourglass.
  For I = 0 To ScaleWidth Step 50       ' Set random color and draw circles on form.
    ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
    Circle (I, ScaleHeight * Rnd), 400
  Next
  Screen.MousePointer = 0               ' Return pointer to normal.
End Sub