OnMouseDown()

View as Markdown

Definition

An event driven method which is called any time the mouse pointer over the chart control has the mouse button pressed.

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 OnMouseDown(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 clicked

Examples

1public override void OnMouseDown(ChartControl chartControl, ChartPanel chartPanel, ChartScale chartScale, ChartAnchor dataPoint)
2{
3 switch (DrawingState)
4 {
5 case DrawingState.Building:
6 dataPoint.CopyDataValues(Anchor);
7 Anchor.IsEditing = false;
8 DrawingState = DrawingState.Normal;
9 IsSelected = false;
10 break;
11 case DrawingState.Normal:
12 // make sure they clicked near us. use GetCursor incase something has more than one point
13 Point point = dataPoint.GetPoint(chartControl, chartPanel, chartScale);
14 if (GetCursor(chartControl, chartPanel, chartScale, point) != null)
15 DrawingState = DrawingState.Moving;
16 else
17 IsSelected = false;
18 break;
19 }
20}