Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ChartSheetBase.MouseMove Event

Occurs when the position of the mouse pointer changes over the Microsoft.Office.Tools.Excel.ChartSheetBase.

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

public event ChartEvents_MouseMoveEventHandler MouseMove

The following code example demonstrates a handler for the MouseMove event that displays a message box when the mouse pointer moves over the current Microsoft.Office.Tools.Excel.ChartSheetBase while the primary mouse button is being pressed.

private void DisplayMouseMove()
{
    Globals.Sheet1.Range["A1", "A5"].Value2 = 22;
    Globals.Sheet1.Range["B1", "B5"].Value2 = 55;

    this.SetSourceData(Globals.Sheet1.Range["A1", "B5"],
        Excel.XlRowCol.xlColumns);
    this.ChartType = Excel.XlChartType.xl3DColumn;

    this.MouseMove +=
        new Excel.ChartEvents_MouseMoveEventHandler(
        ChartSheet1_MouseMove);
}

void ChartSheet1_MouseMove(int Button, int Shift, int x, int y)
{
    if (Button == (int)Excel.XlMouseButton.xlPrimaryButton)
    {
        MessageBox.Show("The mouse is moving over the chart sheet.");
    }
}

Show:
© 2015 Microsoft