Я использовал этот волнистый sh, чтобы нарисовать подчеркивание текста. Но в некоторых местах линия нарисована неправильно. Как нарисовать правильную волнистую линию?
введите описание изображения здесь
//pathPen is used to draw line with square cap at start and end.
Pen pathPen = new Pen(new SolidColorBrush(Colors.Red), 0.2);
pathPen.EndLineCap = PenLineCap.Square;
pathPen.StartLineCap = PenLineCap.Square;
//pathGeometry is used to draw segment of wave line by usig BezierSegment.
Point pathStart = new Point(0, 1);
BezierSegment pathSegment = new BezierSegment(new Point(1, 0), new Point(2, 2), new Point(3, 1), true);
PathFigure pathFigure = new PathFigure(pathStart, new PathSegment[] { pathSegment }, false);
PathGeometry pathGeometry = new PathGeometry(new PathFigure[] { pathFigure });
//squigglyBrush is customized to darw a tile of pathGeometry.
DrawingBrush squigglyBrush = new DrawingBrush();
squigglyBrush.Viewport = new Rect(0, 0, 6, 4.6);
squigglyBrush.ViewportUnits = BrushMappingMode.Absolute;
squigglyBrush.TileMode = TileMode.Tile;
squigglyBrush.Drawing = new GeometryDrawing(null, pathPen, pathGeometry);