private static void ExportTextShape(RadDiagramTextShape shape, Rect enclosingBounds, RadFixedPage page) { var bounds = new Rect(shape.Bounds.X - enclosingBounds.X, shape.Bounds.Y - enclosingBounds.Y, shape.Bounds.Width, shape.Bounds.Height); var transformGroup = new TransformGroup(); transformGroup.Children.Add(new RotateTransform() { Angle = shape.RotationAngle, CenterX = bounds.Width / 2, CenterY = bounds.Height / 2 }); transformGroup.Children.Add(new TranslateTransform() { X = bounds.X, Y = bounds.Y }); var position = new MatrixPosition(transformGroup.Value); FixedContentEditor containerEditor = CreateEditor(new EditorInfo(page, position, shape, bounds, shape.BorderBrush, shape.RotationAngle), true); containerEditor.DrawRectangle(new Rect(new Point(), bounds.ToSize())); if (shape.Content != null) { var center = bounds.Center(); ExportContent(shape, bounds, shape.RotationAngle, page, (s) => { return(new Point(bounds.Center().X - s.Width / 2, center.Y - s.Height / 2)); }); } }
private void GetRandom_N_Glyphs(int n) { for (int i = 0; i < n; i++) { RadDiagramTextShape shape = new RadDiagramTextShape() { Content = allGlyphs[random.Next(0, allGlyphs.Count)].GlyphContent, Width = 64, Height = 64, }; this.diagram.Items.Add(shape); } this.diagram.Layout(); this.diagram.AutoFitAsync(new Thickness(10), true); }
private static void ExportTextShape(RadDiagramTextShape shape, Rect enclosingBounds, RadFixedPage page) { var bounds = new Rect(shape.Bounds.X - enclosingBounds.X, shape.Bounds.Y - enclosingBounds.Y, shape.Bounds.Width, shape.Bounds.Height); var transformGroup = new TransformGroup(); transformGroup.Children.Add(new RotateTransform() { Angle = shape.RotationAngle, CenterX = bounds.Width / 2, CenterY = bounds.Height / 2 }); transformGroup.Children.Add(new TranslateTransform() { X = bounds.X, Y = bounds.Y }); var position = new MatrixPosition(transformGroup.Value); FixedContentEditor containerEditor = CreateEditor(new EditorInfo(page, position, shape, bounds, shape.BorderBrush, shape.RotationAngle), true); containerEditor.DrawRectangle(new Rect(new Point(), bounds.ToSize())); if (shape.Content != null) { var center = bounds.Center(); ExportContent(shape, bounds, shape.RotationAngle, page, (s) => { return new Point(bounds.Center().X - s.Width / 2, center.Y - s.Height / 2); }); } }