This documentation is archived and is not being maintained.

Chart.MouseDown Event


Occurs when a mouse button is pressed when the pointer is over a Chart control.

Namespace:   Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

event ChartEvents_MouseDownEventHandler MouseDown

The following code example creates a Chart with a handler for the MouseDown event that displays the coordinates of the mouse pointer in cell D14 when the mouse button is pressed while the pointer is over the chart.

private void DisplayMouseDown()
    this.Range["A1", "A5"].Value2 = 22;
    this.Range["B1", "B5"].Value2 = 55;

    Microsoft.Office.Tools.Excel.Chart chart1 =
        this.Controls.AddChart(this.Range["D2", "H12"], 
    chart1.SetSourceData(this.Range["A1", "B5"], 
    chart1.ChartType = Excel.XlChartType.xl3DColumn;

    chart1.MouseDown +=
        new Excel.ChartEvents_MouseDownEventHandler(

void chart1_MouseDown(int Button, int Shift, int x, int y)
    this.Range["D14"].Value2 = "The chart was clicked at" +
        " coordinates " + x.ToString() + ", " + y.ToString();
Return to top