Esempio n. 1
0
        private Color GetMouseOverColor(Color c)
        {
            var hls = new HlsColor(c);

            hls.Lighten(0.25f);
            return(hls.Color);
        }
Esempio n. 2
0
        public ChartColumn(ChartValue cv, NumberFormatInfo nfi, Color c1, double colWidth, double availableHeight, double range)
        {
            this.availableHeight = availableHeight;
            if (range == 0)
            {
                range = availableHeight;
            }
            this.range = range;

            vtext = new TextBlock();

            Binding binding = new Binding();

            binding.Source    = this;
            binding.Path      = new PropertyPath("ColumnValue");
            binding.Converter = new NumberConverter(nfi);

            vtext.SetBinding(TextBlock.TextProperty, binding);
            vtext.HorizontalAlignment = HorizontalAlignment.Center;

            r         = new Rectangle();
            r.Width   = colWidth;
            r.Height  = 0;
            r.RadiusX = r.RadiusY = 2;

            HlsColor hls = new HlsColor(c1);

            hls.Lighten(.3f);
            Color c2 = hls.Color;

            hls = new HlsColor(c1);
            hls.Darken(.3f);
            Color stroke = hls.Color;

            r.Stroke          = new SolidColorBrush(stroke);
            r.StrokeThickness = 1;
            r.Fill            = new LinearGradientBrush(c1, c2, new Point(0, 0), new Point(0, 1));

            TextBlock label = new TextBlock();

            label.Text = cv.Label;
            label.HorizontalAlignment = HorizontalAlignment.Center;

            this.Children.Add(vtext);
            this.Children.Add(r);
            this.Children.Add(label);

            this.value = cv;
            this.SetValue(ColumnValueProperty, cv.Value);
        }
Esempio n. 3
0
 Brush GetHighlightBrush()
 {
     if (_normal == null)
     {
         this._normal = this.Background;
     }
     if (_highlight == null)
     {
         SolidColorBrush temp = this._normal as SolidColorBrush;
         if (temp != null)
         {
             var hls = new HlsColor(temp.Color);
             hls.Lighten(0.25f);
             _highlight = new SolidColorBrush(hls.Color);
         }
         else
         {
             _highlight = new SolidColorBrush(Color.FromArgb(0xff, 0x3E, 0x3E, 0x40));
         }
     }
     return(_highlight);
 }