Avatar of AndyC1000
AndyC1000
 asked on

System.Drawing.Color add all to list (C#)

Hello,

Need to store colors in a list for a radar chart.  The number of series are unknown, want to loop through the colors list to assign a color to each series plotted.

Can't find how to get all colors of System.Drawing.Color to add it to a list.  

List<string> colors = System.Drawing.Color<?>

AC.
C#

Avatar of undefined
Last Comment
joriszwaenepoel

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
james-ct16

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
AndyC1000

ASKER
I tried to get the example working and realised the list should be of type System.Drawing.Color or am I accessing it incorrectly.  

[code]

for(int i = 0; i < list.Count; i++){ // contains the number of series.

string str = "series" + i;
for(int j = 0; j < colours.Count; j++){

System.Windows.Forms.DataVisualization.Charting.series series str = new System.Windows.Forms.DataVisualization.Charting.series()
series.Color = // colours[i];??

}

}
[/code]

There's also a problem with syntax in these two lines, conflicting local variables.
string str = "series" + i;
System.Windows.Forms.DataVisualization.Charting.series series str = new .....

SOLUTION
Kumaraswamy R

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
joriszwaenepoel

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck