共用方式為


ChartSheetBase.SeriesChange 事件

會在 Microsoft.Office.Tools.Excel.ChartSheetBase 資料點的值變更時發生。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel.v4.0.Utilities (在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

語法

'宣告
Public Event SeriesChange As ChartEvents_SeriesChangeEventHandler
public event ChartEvents_SeriesChangeEventHandler SeriesChange

範例

下列程式碼範例示範 SeriesChange 事件的處理常式,這個處理常式在目前 Microsoft.Office.Tools.Excel.ChartSheetBase 的資料點變更時,將資料點的框線色彩設定為綠色。

Private Sub ChangePointColorWhenSeriesChange()
    Globals.Sheet1.Range("A1", "A5").Value2 = 22
    Globals.Sheet1.Range("B1", "B5").Value2 = 55

    Me.SetSourceData(Globals.Sheet1.Range("A1", "B5"), _
        Excel.XlRowCol.xlColumns)
    Me.ChartType = Excel.XlChartType.xl3DColumn
End Sub

Sub ChartSheet1_SeriesChange(ByVal SeriesIndex As Integer, _
    ByVal PointIndex As Integer) Handles Me.SeriesChange

    Dim series1 As Excel.Series = _
        CType(Me.SeriesCollection(SeriesIndex), Excel.Series)
    Dim point1 As Excel.Point = _
        CType(series1.Points(PointIndex), Excel.Point)

    point1.Border.Color = _
            ColorTranslator.ToOle(Color.Green)
End Sub
private void ChangePointColorWhenSeriesChange()
{
    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.SeriesChange +=
        new Excel.ChartEvents_SeriesChangeEventHandler(
        ChartSheet1_SeriesChange);
}

void ChartSheet1_SeriesChange(int SeriesIndex, int PointIndex)
{
    Excel.Series series1 =
        (Excel.Series)this.SeriesCollection(SeriesIndex);
    Excel.Point point1 = (Excel.Point)series1.Points(PointIndex);

    point1.Border.Color =
        ColorTranslator.ToOle(Color.Green);
}

.NET Framework 安全性

請參閱

參考

ChartSheetBase 類別

Microsoft.Office.Tools.Excel 命名空間