次の方法で共有


Chart.DragPlot イベント (2007 System)

更新 : 2007 年 11 月

Chart コントロール上でセル範囲がドラッグ アンド ドロップされたときに発生します。

名前空間 :  Microsoft.Office.Tools.Excel
アセンブリ :  Microsoft.Office.Tools.Excel.v9.0 (Microsoft.Office.Tools.Excel.v9.0.dll 内)

構文

'宣言
Public Event DragPlot As ChartEvents_DragPlotEventHandler
'使用
Dim instance As Chart
Dim handler As ChartEvents_DragPlotEventHandler

AddHandler instance.DragPlot, handler
public 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.");
}

アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

Chart クラス

Chart メンバ

Microsoft.Office.Tools.Excel 名前空間