Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Canvas imageCanvas = new Canvas { Width = 1651, Height = 2551, Background = Brushes.White };
- Canvas Test = new Canvas();
- System.Windows.Shapes.Path Path = new System.Windows.Shapes.Path();
- Path.Data = Geometry.Parse("M 0,0 H 287 V 287 H 0 Z");
- Path.Stretch = Stretch.Fill;
- Path.Stroke = Brushes.Black;
- Path.StrokeThickness = 1;
- Test.Width = 500;
- Test.Height = 500;
- Test.Children.Add(Path);
- imageCanvas.Children.Add(Test);
- Canvas.SetTop(Test, 10);
- Canvas.SetLeft(Test, 10);
- // Update layout
- Size size = new Size(imageCanvas.Width, imageCanvas.Height);
- imageCanvas.Measure(size);
- imageCanvas.Arrange(new Rect(size));
- RenderTargetBitmap bitmapRenderer = new RenderTargetBitmap((int)size.Width, (int)size.Height, 96, 96, PixelFormats.Pbgra32);
- bitmapRenderer.Render(imageCanvas);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement