Files
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

3.4 KiB

title, ms.date, helpviewer_keywords, ms.assetid
title ms.date helpviewer_keywords ms.assetid
Mouse Pointers 03/30/2017
pointers [Windows Forms], setting
mouse pointers
mouse cursors
mouse pointers [Windows Forms], setting
cursors [Windows Forms], setting
mouse [Windows Forms], cursors
c3400d85-de5b-42e8-abc3-d6088d69ee53

Mouse Pointers in Windows Forms

The mouse pointer, which is sometimes referred to as the cursor, is a bitmap that specifies a focus point on the screen for user input with the mouse. This topic provides an overview of the mouse pointer in Windows Forms and describes some of the ways to modify and control the mouse pointer.

Accessing the Mouse Pointer

The mouse pointer is represented by the xref:System.Windows.Forms.Cursor class, and each xref:System.Windows.Forms.Control has a xref:System.Windows.Forms.Control.Cursor%2A?displayProperty=nameWithType property that specifies the pointer for that control. The xref:System.Windows.Forms.Cursor class contains properties that describe the pointer, such as the xref:System.Windows.Forms.Cursor.Position%2A and xref:System.Windows.Forms.Cursor.HotSpot%2A properties, and methods that can modify the appearance of the pointer, such as the xref:System.Windows.Forms.Cursor.Show%2A, xref:System.Windows.Forms.Cursor.Hide%2A, and xref:System.Windows.Forms.Cursor.DrawStretched%2A methods.

Controlling the Mouse Pointer

Sometimes you may want to limit the area in which the mouse pointer can be used or change the position the mouse. You can get or set the current location of the mouse using the xref:System.Windows.Forms.Cursor.Position%2A property of the xref:System.Windows.Forms.Cursor. In addition, you can limit the area the mouse pointer can be used be setting the xref:System.Windows.Forms.Cursor.Clip%2A property. The clip area, by default, is the entire screen.

Changing the Mouse Pointer

Changing the mouse pointer is an important way of providing feedback to the user. For example, the mouse pointer can be modified in the handlers of the xref:System.Windows.Forms.Control.MouseEnter and xref:System.Windows.Forms.Control.MouseLeave events to tell the user that computations are occurring and to limit user interaction in the control. Sometimes, the mouse pointer will change because of system events, such as when your application is involved in a drag-and-drop operation.

The primary way to change the mouse pointer is by setting the xref:System.Windows.Forms.Control.Cursor%2A?displayProperty=nameWithType or xref:System.Windows.Forms.Control.DefaultCursor%2A property of a control to a new xref:System.Windows.Forms.Cursor. For examples of changing the mouse pointer, see the code example in the xref:System.Windows.Forms.Cursor class. In addition, the xref:System.Windows.Forms.Cursors class exposes a set of xref:System.Windows.Forms.Cursor objects for many different types of pointers, such as a pointer that resembles a hand. To display the wait pointer, which resembles an hourglass, whenever the mouse pointer is on the control, use the xref:System.Windows.Forms.Control.UseWaitCursor%2A property of the xref:System.Windows.Forms.Control class.

See also