示例#1
0
        private void CreateSpectrum()
        {
            pickerBrush = new LinearGradientBrush()
            {
                StartPoint             = new Point(0.5, 0),
                EndPoint               = new Point(0.5, 1),
                ColorInterpolationMode = ColorInterpolationMode.SRgbLinearInterpolation
            };



            List <Color> colorsList    = ColorUtilities.GenerateHsvSpectrum();
            double       stopIncrement = (double)1 / colorsList.Count;

            int i;

            for (i = 0; i < colorsList.Count; i++)
            {
                pickerBrush.GradientStops.Add(new GradientStop(colorsList[i], i * stopIncrement));
            }

            pickerBrush.GradientStops[i - 1].Offset = 1.0;
            _spectrumDisplay.Fill = pickerBrush;
        }