在将单元格范围拖放至 Chart 控件上时发生。
命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel(在 Microsoft.Office.Tools.Excel.dll 中)
语法
声明
Event DragPlot As ChartEvents_DragPlotEventHandler
event ChartEvents_DragPlotEventHandler DragPlot
示例
下面的代码示例创建一个具有 DragPlot 事件的处理程序的 Chart,该处理程序在将单元格范围拖放至图表上时显示一个消息框。
WithEvents DragPlotChart As Microsoft.Office.Tools.Excel.Chart
Private Sub DisplayDragPlot()
    Me.Range("A1", "A5").Value2 = 22
    Me.Range("B1", "B5").Value2 = 55
    DragPlotChart = Me.Controls.AddChart(Me.Range("D2", "H12"), _
        "DragPlotChart")
    DragPlotChart.SetSourceData(Me.Range("A1", "B5"), _
        Excel.XlRowCol.xlColumns)
    DragPlotChart.ChartType = Excel.XlChartType.xl3DColumn
End Sub
Sub DragPlotChart_DragPlot() Handles DragPlotChart.DragPlot
    MsgBox("A range was dragged and dropped on the chart.")
End Sub
private void DisplayDragPlot()
{
    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");
    chart1.SetSourceData(this.Range["A1", "B5"], 
        Excel.XlRowCol.xlColumns);
    chart1.ChartType = Excel.XlChartType.xl3DColumn;
    chart1.DragPlot +=
        new Excel.ChartEvents_DragPlotEventHandler(
        chart1_DragPlot);
}
void chart1_DragPlot()
{
    MessageBox.Show("A range was dragged and dropped on the chart.");
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。