namespace Yw.WinFrmUI { /// /// /// public class HydroPumpCurveColorHelper { //缓存 private static List _cache = new List() { Color.Red, Color.Blue, Color.Green,Color.Fuchsia,Color.Maroon, Color.MidnightBlue, Color.Aquamarine,Color.DodgerBlue, Color.BurlyWood }; /// /// 获取随机颜色 /// public static Color GetRandomColor(int index) { if (index <= _cache.Count - 1) { return _cache[index]; } var random = new Random(); int r = random.Next(1, 256); int g = random.Next(1, 256); int b = random.Next(1, 256); return Color.FromArgb(r, g, b); } } }