次の方法で共有


GetPointAtFractionLength

This is such a cool API, this is one sample usage (ie. Drawing a clock). I could see things like manually tracing a PathGeometry which could contain complex Bezier segments.

double len = 0d;
Point pt, ptTan;
EllipseGeometry geo = new EllipseGeometry(new Point(50, 50), 50, 50);
PathGeometry pathGeo = geo.GetFlattenedPathGeometry();

for (int c = 0; c < 12; ++c)
{
    len += (double)(1 / 12d);
    pathGeo.GetPointAtFractionLength(len, out pt, out ptTan);
    Rectangle rect = new Rectangle();
    rect.Height = rect.Width = 2;
    rect.Fill = Brushes.Red;
    this.mainCanvas.Children.Add(rect);

    Canvas.SetTop(rect, pt.Y);
    Canvas.SetLeft(rect, pt.X);
}