public static GetSpectrumColors ( int colorCount ) : Color[] | ||
colorCount | int | |
return | Color[] |
private void SetBackground() { LinearGradientBrush brush = new LinearGradientBrush { StartPoint = new Point(0.5, 0.0), EndPoint = new Point(0.5, 1.0) }; Color[] spectrumColors = ColorUtils.GetSpectrumColors(30); for (int i = 0; i < 30; i++) { double offset = (i * 1.0) / 30.0; GradientStop stop = new GradientStop(spectrumColors[i], offset); brush.GradientStops.Add(stop); } base.Background = brush; }
private void SetBackground() { LinearGradientBrush backgroundBrush = new LinearGradientBrush(); backgroundBrush.StartPoint = new Point(0.5, 0); backgroundBrush.EndPoint = new Point(0.5, 1); const int spectrumColorCount = 30; Color[] spectrumColors = ColorUtils.GetSpectrumColors(spectrumColorCount); for (int i = 0; i < spectrumColorCount; ++i) { double offset = i * 1.0 / spectrumColorCount; GradientStop gradientStop = new GradientStop(spectrumColors[i], offset); backgroundBrush.GradientStops.Add(gradientStop); } Background = backgroundBrush; }