Xceed Chart for WinForms has extensive support for tracking mouse events that occur when the end-user moves or clicks with the mouse over the control.
Working with events is very easy and straightforward. The following table lists the available delegates (see MouseAction Enumeration for more details):
Delegate name | Delegate type | Description |
MouseMove | System.Windows.Forms.MouseEventHandler |
Occurs when the mouse pointer is moved over the control. The event handler receives an argument of type System.Windows.Forms.MouseEventArgs containing data related to this event. |
MouseDown | System.Windows.Forms.MouseEventHandler |
Occurs when the mouse pointer is over the control and a mouse button is pressed. The event handler receives an argument of type System.Windows.Forms.MouseEventArgs containing data related to this event. |
MouseUp | System.Windows.Forms.MouseEventHandler |
Occurs when the mouse pointer is over the control and a mouse button is released. The event handler receives an argument of type System.Windows.Forms.MouseEventArgs containing data related to this event. |
MouseHover | System.EventHandler | Occurs when the mouse pointer hovers over the control. This event is preceded by a MouseMove event. |
MouseWheel | System.Windows.Forms.MouseEventHandler |
Occurs when the mouse wheel moves while the control has focus. The event handler receives an argument of type System.Windows.Forms.MouseEventArgs containing data related to this event. |
MouseEnter | System.EventHandler | Occurs when the mouse pointer enters the control. |
MouseLeave | System.EventHandler | Occurs when the mouse pointer leaves the control. |
As you can see, handling chart events is much like handling normal Windows Forms events. For event handlers of type System.Windows.Forms.MouseEventHandler, the ChartControl's HitTest method is used to get information about the object under the mouse cursor by passing it the coordinates received through the MouseEventArgs. Event handlers of type System.EventHandler refer to the ChartControl as a whole; therefore, the HitTest method is not used.
Let's take a look at a real example demonstrating how to use MouseDown:
C# | |
---|---|
private void Form_Load(object sender, System.EventArgs e) |
Windows Forms: Interactivity\Mouse Events
Web Forms: Getting started\HTML image map, Getting started\HTML image map postback
ChartControl | SeriesInteractivity | Interactivity | HTML Image Map | HTML Image Map with Postback