Läs på engelska Redigera

Dela via


Mouse.Captured Property

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Gets the element that has captured the mouse.

C#
public static System.Windows.IInputElement Captured { get; }

Property Value

The element captured by the mouse.

Examples

The follow example shows how to obtain the element that has mouse capture.

C#
// Mouse.Capture returns an IInputElement.
IInputElement captureElement;

captureElement = Mouse.Captured;

// Update the Label that displays the element with mouse capture.
lblHasMouseCapture.Content = captureElement.ToString();

Remarks

When an element captures the mouse, it receives mouse input whether or not the cursor is within its borders. The mouse is typically captured in this manner only during drag-and-drop operations, and retains capture until the drop action of the drag-and-drop operation occurs.

Applies to

Produkt Versioner
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10