Name
MouseEventArgs
Synopsis
This class encapsulates the data for the
Control.MouseDown
,
Control.MouseUp
, and
Control.MouseMove
events. You can determine the
X
and Y
coordinates of the
mouse (in client coordinates—contrast this with
Control.MousePosition
), the
Button
that was pressed (note that this is the
button that caused the event, not the total set of buttons currently
depressed—you should use
Control.MouseButtons
for this information).
You can also determine the number of Clicks
that
have occurred (i.e., single, double, triple, etc.), and the
Delta
through which the mouse wheel has rotated.
public class MouseEventArgs : EventArgs { // Public Constructors public MouseEventArgs(MouseButtons button, int clicks, int x, int y, int delta); // Public Instance Properties public MouseButtons Button{get; } public int Clicks{get; } public int Delta{get; } public int X{get; } public int Y{get; } }
Hierarchy
System.Object
→ System.EventArgs → MouseEventArgs
Subclasses
StatusBarPanelClickEventArgs
Passed To
Control.{OnMouseWheel()
,
RaiseMouseEvent()}
,
System.Windows.Forms.Design.ComponentTray.{OnMouseDown()
, OnMouseMove()
, OnMouseUp()}
, MouseEventHandler.{BeginInvoke()
,
Invoke()}
Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.