예제 #1
0
        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)); });
            }
        }
예제 #2
0
 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);
 }
예제 #3
0
        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); });
            }
        }