OnMouseMove()

View as Markdown

Definition

An event driven method which is called any time the mouse pointer is over the chart control and a mouse is moving.

Method Return Value

This method does not return a value.

For a combined single click operation, i.e. mouse down click, move and release the dataPoint reported will always be the initial starting one.

Syntax

You must override the method in your Drawing Tool with the following syntax.

public override void OnMouseMove(ChartControl chartControl, ChartPanel chartPanel, ChartScale chartScale, ChartAnchor dataPoint) \{ \}

Method Parameters

ParameterDescription
chartControlA ChartControl representing the x-axis
chartPanelA ChartPanel representing the the panel for the chart
chartScaleA ChartScale representing the y-axis
dataPointA ChartAnchor representing a point where the user is moving the mouse

Examples

1private ChartAnchor lastMouseMoveAnchor = new ChartAnchor();
2private ChartAnchor MyAnchor;
3
4public override void OnMouseMove(ChartControl chartControl, ChartPanel chartPanel, ChartScale chartScale, ChartAnchor dataPoint)
5{
6 // add any logic for when the mouse is moved here
7 if (DrawingState == DrawingState.Moving)
8 {
9 //move the chart anchor when the drawing tool is in a moving state
10 MyAnchor.MoveAnchor(lastMouseMoveAnchor, dataPoint, chartControl, chartPanel, chartScale, this);
11 // dont forget to update delta point to last used!
12 dataPoint.CopyDataValues(lastMouseMoveAnchor);
13 }
14}