protected override void OnPathPropertyChanged(DependencyPropertyChangedEventArgs args) { if (base.PathFigure != null) { this.pathLength = TextOnPathBase.GetPathFigureLength(base.PathFigure); this.GenerateWarpedGeometry(); } }
private void OrientTextOnPath() { double pathFigureLength = TextOnPathBase.GetPathFigureLength(this.PathFigure); double num = 0.0; foreach (UIElement uIElement in this.mainPanel.Children) { uIElement.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); num += uIElement.DesiredSize.Width; } if (pathFigureLength != 0.0 && num != 0.0) { double num2 = pathFigureLength / num; PathGeometry pathGeometry = new PathGeometry(new PathFigure[] { this.PathFigure }); double num3 = num2 * 100.0 * base.FontFamily.Baseline; double num4 = 0.0; foreach (UIElement uIElement in this.mainPanel.Children) { double num5 = num2 * uIElement.DesiredSize.Width; num4 += num5 / 2.0 / pathFigureLength; Point point; Point point2; pathGeometry.GetPointAtFractionLength(num4, out point, out point2); uIElement.RenderTransform = new TransformGroup { Children = { new ScaleTransform(num2, num2), new RotateTransform(Math.Atan2(point2.Y, point2.X) * 180.0 / 3.1415926535897931,num5 / 2.0, num3), new TranslateTransform(point.X - num5 / 2.0, point.Y - num3) } }; num4 += num5 / 2.0 / pathFigureLength; } } }
protected override void OnPathPropertyChanged(DependencyPropertyChangedEventArgs args) { this.pathLength = TextOnPathBase.GetPathFigureLength(base.PathFigure); base.InvalidateMeasure(); base.InvalidateVisual(); }
protected override void OnPathPropertyChanged(DependencyPropertyChangedEventArgs args) { this.pathLength = TextOnPathBase.GetPathFigureLength(base.PathFigure); this.TransformVisualChildren(); }