2
私は画面に表示せずに完全なフォームを印刷する必要があります。私がされて必要なもの画面に表示せずにwpfウィンドウを印刷するにはどうすればいいですか?
:
- はフォーム
- 印刷を初期化し、それ
全画面に表示せず。
お願いします。
私は画面に表示せずに完全なフォームを印刷する必要があります。私がされて必要なもの画面に表示せずにwpfウィンドウを印刷するにはどうすればいいですか?
:
全画面に表示せず。
お願いします。
これは、PrintDialog.PrintVisualメソッドを使用して行うことができます。
var capabilities = printDlg.PrintQueue.GetPrintCapabilities(printDlg.PrintTicket);
//get scale of the print wrt to screen of WPF visual
var scale = Math.Min(capabilities.PageImageableArea.ExtentWidth/this.ActualWidth, capabilities.PageImageableArea.ExtentHeight/this.ActualHeight);
//Transform the Visual to scale
this.LayoutTransform = new ScaleTransform(scale, scale);
// Get the size of the printer page
var sz = new Size(capabilities.PageImageableArea.ExtentWidth, capabilities.PageImageableArea.ExtentHeight);
//update the layout of the visual to the printer page size.
this.Measure(sz);
this.Arrange(new Rect(new Point(capabilities.PageImageableArea.OriginWidth, capabilities.PageImageableArea.OriginHeight), sz));
//now print the visual to printer to fit on the one page.
printDlg.PrintVisual(visual, String.Empty);
これは2つの票を持っていますが、本当に質問に答えていますか?視覚的(これ)がまだ印刷される前にスクリーンに表示されなければならないように見えます。 – MojoFilter
hi。これはmvvmと何が関係がありますか? –
削除されたmvvmタグ – SvenG