MouseEventArgs.GetPosition Method (IInputElement)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Returns the position of the mouse pointer relative to the specified element.

Namespace:   System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

public Point GetPosition(
	IInputElement relativeTo
)

Parameters

relativeTo
Type: System.Windows.IInputElement

The element to use as the frame of reference for calculating the position of the mouse pointer.

Return Value

Type: System.Windows.Point

The x- and y-coordinates of the mouse pointer position relative to the specified object.

The point (0,0) is the upper-left corner of the frame of reference.

The static Mouse.GetPosition method can also be used to obtain the position of the mouse.

.NET Framework
Available since 3.0
Return to top
Show: