示例#1
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            // Move these to normal labels
            Typeface      courierTypeface = new Typeface(this.FontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
            FormattedText ftMinimum       = new FormattedText(Minimum.ToShortTimeString(), System.Globalization.CultureInfo.CurrentCulture, this.FlowDirection, courierTypeface, 14.0, this.Foreground);
            FormattedText ftMaximum       = new FormattedText(Maximum.ToShortTimeString(), System.Globalization.CultureInfo.CurrentCulture, this.FlowDirection, courierTypeface, 14.0, this.Foreground);

            drawingContext.DrawText(ftMinimum, new Point(0, this.ActualHeight - ftMinimum.Height));
            drawingContext.DrawText(ftMaximum, new Point(this.ActualWidth - ftMaximum.Width, this.ActualHeight - ftMaximum.Height));

            if (this.Minimum == this.Maximum)
            {
                return;
            }
            Pen p = new Pen(this.Foreground, 1);

            //IList<double> minorTickValues = this.CreateDateTimeTickValues(               this.Minimum, this.Maximum, this.ActualMinorStep, this.actualMinorIntervalType);
            IList <DateTime> majorTickValues  = this.CreateDateTimeTickValues(this.Minimum, this.Maximum, this.ActualMajorStep, this.actualIntervalType);
            IList <DateTime> majorLabelValues = majorTickValues;

            foreach (var item in majorTickValues)
            {
                var x = this.TimeToPosition(item);
                drawingContext.DrawLine(p, new Point(x, 0), new Point(x, 5));
            }

            UpdateRange2(this.StartTime, this.StopTime);
        }