Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MouseEventArgs::X Property

 

Gets the x-coordinate of the mouse during the generating mouse event.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public:
property int X {
	int get();
}

Property Value

Type: System::Int32

The x-coordinate of the mouse, in pixels.

The mouse coordinates vary based on the event being raised. For example, when the Control::MouseMove event is handled, the mouse coordinate values are relative to the coordinates of the control that raised the event. Some events related to drag-and-drop operations have associated mouse-coordinate values that are relative to the form origin or the screen origin.

The following code example uses the X and Y properties to display the current position of the mouse pointer in a ToolTip window.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft