如何使用.NET设置Excel散点图中单个点的颜色?

我想通过C#设置Excel散点图中各个点的颜色,但无法使其工作。 这是我目前使用的代码。 请注意,代码的MarkerStyle和MarkerSize部分起作用 – 所以我的问题是关于颜色。 我怀疑我在某处丢了一个演员。

var point =(Excel.Point)series.Points(index);

point.MarkerStyle = XlMarkerStyle.xlMarkerStyleSquare; point.MarkerSize = 8;

point.MarkerBackgroundColor = 10; point.MarkerForegroundColor = 10;

在此先感谢您的任何见解!

它看起来像你期待设置一个颜色索引,而不是一个RGB(我说,因为你设置为10)。 我相信MarkerForegroundColor期待RGB颜色。 你是不是要设置MarkerForegroundColorIndex?