public override void Echo(TimeScaler Scaler)
 {
     using (DrawingContext dc = this.RenderOpen())
     {
         var x = Scaler.GetHorizontalOffset(StartDate);
         var w = Scaler.GetWidth(EndDate - StartDate);
         var y = Scaler.GetVerticalOffset(this.Line);
         var h = Scaler.GetHeight(this.Line);
         //var pb = new Pen(new SolidColorBrush(Color.Subtract((Foreground as SolidColorBrush).Color, Colors.Green)), 2);
         var pb = new Pen(new SolidColorBrush(Colors.Violet), 2);
         dc.DrawRectangle(Foreground, pb, new System.Windows.Rect(-x-w, y, w, h));
     }
 }
Exemple #2
0
        public override void Echo(TimeScaler Scaler)
        {
            //this.Opacity = 0.5;
            using (DrawingContext dc = this.RenderOpen())
            {
                var x = Scaler.GetHorizontalOffset(StartDate);
                var w = Scaler.GetWidth(EndDate - StartDate);
                var y = Scaler.GetVerticalOffset(this.Line);
                var h = Scaler.GetHeight(this.Line);

                Rect r = new Rect(x, y + h * (1 - Value), w, h * Value);
                r = RoundRect(r);

                var gl = new GuidelineSet();
                AddRectToGuidlineSet(gl, r, 0);
                dc.PushGuidelineSet(gl);

                dc.DrawRectangle(Background, null, r);

                dc.Pop();   // GuidelineSet
            }
        }
        public override void Echo(TimeScaler Scaler)
        {
            using (DrawingContext dc = this.RenderOpen())
            {
                var x = Scaler.GetHorizontalOffset(StartDate);
                var w = Scaler.GetWidth(EndDate - StartDate);
                var y = Scaler.GetVerticalOffset(this.Line);
                var h = Scaler.GetHeight(this.Line);
                Pen pb = new Pen(StrokeBrush ?? Background, 1);

                Rect r = new Rect(x, y, w, h);
                r = RoundRect(r);

                var gl = new GuidelineSet();
                AddRectToGuidlineSet(gl, r, pb.Thickness);
                dc.PushGuidelineSet(gl);

                dc.DrawRectangle(Background, pb, r);

                if (LabelText != null)
                {
                    var ZeroX = Scaler.GetHorizontalOffset(Scaler.LeftDate);
                    var TextX = Math.Max(x, ZeroX) + 2;

                    var ft = new FormattedText(this.LabelText,
                        System.Globalization.CultureInfo.CurrentCulture,
                        System.Windows.FlowDirection.LeftToRight,
                        LabelTypeFace, 8, Foreground);

                    if (TextX + ft.Width + 10 <= x + w)
                        dc.DrawText(ft, new Point(TextX, y + 3));
                }

                dc.Pop();   // GuidelineSet
            }
        }