Share via


Visual Basic Reference

MousePointer Property Example

This example changes the mouse pointer to an hourglass while circles are drawn across the 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.

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