Sample code as follow,
Chart.SerialsCollection(1).Point(1).Format.Fill.ForeColor = System.Drawing.Color.Red;
Return an error. Cannot implicitly convert type, one is a Struct, the other is ColorFormat.
ForeColor.RGB is Int type, I can only get 3 ints from Color.Red.R, Color.Red.G and Color.Red.B. How to assign the color I want to ForeColor property?
Try RGB property
ForeColor.RGB
E.g.
As suggested in the comments, use ColorTranslator.ToOle
Or, entering the
RGB
values:Some additional information, so I'm not just repeating the comments:
ForeColor.RGB
can be represented in Hex as0xBBGGRR
(source). Knowing that, you could create the following function:Use:
The reason
ToArgb()
, used in the other answer, does not work because its Hex representation is0xAARRGGBB