Пример #1
0
        protected override void OnRender(DrawingContext dc)
        {
            LinearGradientBrush h = new LinearGradientBrush();

            h.StartPoint = new Point(0, 0);
            h.EndPoint   = new Point(1, 0);
            h.GradientStops.Add(new GradientStop(Colors.White, 0.00));
            h.GradientStops.Add(new GradientStop(ColorPickerUtil.ColorFromHSB(Hue, 1, 1), 1.0));
            dc.DrawRectangle(h, null, new Rect(0, 0, ActualWidth, ActualHeight));

            LinearGradientBrush v = new LinearGradientBrush();

            v.StartPoint = new Point(0, 0);
            v.EndPoint   = new Point(0, 1);
            v.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, 0, 0, 0), 1.00));
            v.GradientStops.Add(new GradientStop(Color.FromArgb(0x80, 0, 0, 0), 0.50));
            v.GradientStops.Add(new GradientStop(Color.FromArgb(0x00, 0, 0, 0), 0.00));
            dc.DrawRectangle(v, null, new Rect(0, 0, ActualWidth, ActualHeight));

            UpdateSaturationOffset();
            UpdateBrightnessOffset();
        }
Пример #2
0
 public void UpdateColor()
 {
     Color      = ColorPickerUtil.ColorFromHSB(Hue, Saturation, Brightness);
     ColorBrush = new SolidColorBrush(Color);
 }
Пример #3
0
 private void UpdateColor()
 {
     Color      = ColorPickerUtil.ColorFromHSB(Hue, 1, 1);
     ColorBrush = new SolidColorBrush(Color);
 }