MouseEventArgs.GetPosition(IInputElement) MouseEventArgs.GetPosition(IInputElement) MouseEventArgs.GetPosition(IInputElement) MouseEventArgs.GetPosition(IInputElement) Method

Definition

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

public:
 System::Windows::Point GetPosition(System::Windows::IInputElement ^ relativeTo);
public System.Windows.Point GetPosition (System.Windows.IInputElement relativeTo);
member this.GetPosition : System.Windows.IInputElement -> System.Windows.Point
Public Function GetPosition (relativeTo As IInputElement) As Point

Parameters

relativeTo
IInputElement IInputElement IInputElement IInputElement

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

Returns

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

Remarks

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.

Applies to

See also