Ejemplo n.º 1
0
 protected override void OnRender(DrawingContext dc)
 {
     var pen = new Pen(this.Fill, this.PenWidth);
     pen.Freeze();
     var line = new Line(this.ActualWidth, this.ActualHeight, this.ReservedSpace, this.Placement, this.IsDirectionReversed);
     Vector offset = new Vector(0, 0);
     switch (this.Placement)
     {
         case TickBarPlacement.Left:
             offset = new Vector(this.ActualWidth, 0);
             break;
         case TickBarPlacement.Right:
             offset = new Vector(-1 * this.ActualWidth, 0);
             break;
         case TickBarPlacement.Top:
             offset = new Vector(0, this.ActualHeight);
             break;
         case TickBarPlacement.Bottom:
             offset = new Vector(0, -1 * this.ActualHeight);
             break;
     }
     foreach (var tick in this.AllTicks)
     {
         var p = TickHelper.ToPos(tick, this.Minimum, this.Maximum, line).Round(0);
         var l = new Line(p, p + offset);
         dc.DrawLine(pen, l);
     }
 }
Ejemplo n.º 2
0
 protected override void OnRender(DrawingContext dc)
 {
     var pen = new Pen(this.Fill, this.PenWidth);
     pen.Freeze();
     var arc = Arc.Fill(this.RenderSize, this.MinAngle, this.MaxAngle, this.IsDirectionReversed);
     for (int i = 0; i < this.AllTicks.Count; i++)
     {
         var tick = this.AllTicks[i];
         var angle = TickHelper.ToAngle(tick, this.Minimum, this.Maximum, arc);
         var po = arc.GetPoint(angle, -this.ReservedSpace / 2);
         var pi = arc.GetPoint(angle, -this.ReservedSpace / 2 - this.TickLength);
         var line = new Line(po, pi);
         dc.DrawLine(pen, line);
     }
 }
Ejemplo n.º 3
0
 internal static void DrawLine(this DrawingContext dc, Pen pen, Line l)
 {
     dc.DrawLine(pen, l.StartPoint, l.EndPoint);
 }
Ejemplo n.º 4
0
 internal static Line Transform(this RotateTransform transform, Line line)
 {
     var p1 = transform.Transform(line.StartPoint);
     var p2 = transform.Transform(line.EndPoint);
     return new Line(p1, p2);
 }