C# wpf 3D visual studio 2010 net 4.5
Hi
I am trying to print out the 3D image I have created but can not get it right. The image that is printed is changing in size depending on how large the window is etc. or it is clipped etc.
What I would like is to print the view port on the printer, stretching it so wide as the paper is and keeping aspect ration.
PrintDialog dialog = new PrintDialog();
if (dialog.ShowDialog() != true)
{ return; }
StackPanel myPanel = new StackPanel();
myPanel.Margin = new Thickness(40);
Image myImage = new Image();
myImage.Width = dialog.PrintableAreaWidth - (2 * MYDPI);
myImage.Stretch = Stretch.Uniform;
RenderTargetBitmap bmp = new RenderTargetBitmap((int)dialog.PrintableAreaWidth, (int)dialog.PrintableAreaWidth, 96, 96, PixelFormats.Pbgra32);
bmp.Render(myViewPort);
myImage.Source = bmp;
myPanel.Children.Add(myImage);
myPanel.Measure(new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight));
myPanel.Arrange(new Rect(new Point(0, 0), myPanel.DesiredSize));
dialog.PrintVisual(myPanel, myName);
The following worked, now the picture get scaled to the size of the paper regardless of the size of the viewport
...