-1
如何在打印完整窗口之前爲其打印預覽功能,這是我用於打印整個窗口的代碼。如何在WPF中打印預覽,獲取完整的窗口?
我的背後代碼:
private void Canvas_Print_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
PrintDialog printdlg = new PrintDialog();
MainWindow win = new MainWindow();
this.Width = 350;
this.Background = Brushes.White;
panel.ScrollToTop();
panel.ScrollToLeftEnd();
win.Tag = this;
if (printdlg.ShowDialog() == true)
{
printdlg.PrintVisual(panel.Content as Visual, "MyApplication");
}
}
你可以使用視覺刷。 – pushpraj
但Visual Brush是用於像位圖這樣的圖像在這種情況下它將如何有用 – Krrish
還有很多不同之處。沒有內置的功能。一種選擇是使用RenderTargetBitmap並創建當前MainWindow的截圖(圖像)並將其顯示在控件中。我會建議谷歌搜索不同的選項。 – Kcvin