void elementChart_MouseDown(int Button, int Shift, int x, int y) { if (flag == 1) { Excel.Chart chart = Globals.ThisAddIn.Application.ActiveChart; //Int32 ; Int32 elementID = 0; Int32 arg1 = 0; Int32 arg2 = 0; chart.GetChartElement(x, y, ref elementID, ref arg1, ref arg2); // string element = ((Excel.XlChartItem)elementID).ToString(); if (element == "xlSeries") { Excel.SeriesCollection series = (Excel.SeriesCollection)chart.SeriesCollection(); Excel.Series Sseries = series.Item(arg1); Sseries.Format.Fill.BackColor.RGB = System.Drawing.Color.FromArgb(SelectRGB[2], SelectRGB[1], SelectRGB[0]).ToArgb(); Sseries.Format.Fill.ForeColor.RGB = System.Drawing.Color.FromArgb(SelectRGB[2], SelectRGB[1], SelectRGB[0]).ToArgb(); flag = 0; } } // MessageBox.Show("Chart element is: " + ((Excel.XlChartItem)elementID).ToString() // + "\n arg1 is: " + arg1.ToString() + "\n arg2 is: " + arg2.ToString()); }