WPF:如何在横向模式下打印? [英] WPF: How do you print in Landscape mode?

查看:529
本文介绍了WPF:如何在横向模式下打印?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在线找到了此功能,效果很好...除了我可以无法弄清楚如何将其默认设置为横向打印.

found this function online, which works great... except I can't figure out how to default it to print in landscape.

private void PrintClick(object sender, RoutedEventArgs e)
{
  PrintDialog dialog = new PrintDialog();
  if (dialog.ShowDialog() == true)
  { dialog.PrintVisual(_PrintCanvas, "My Canvas"); }
}

实际上如何设置默认值以将我的wpf内容打印为横向模式?

How does one actually set the default to print my wpf content to landscape mode?

推荐答案

private void PrintClick(object sender, RoutedEventArgs e)
{
    PrintDialog dialog = new PrintDialog();
    if (dialog.ShowDialog() == true)
    { 
==>     printDialog.PrintTicket.PageOrientation = PageOrientation.Landscape;
        dialog.PrintVisual(_PrintCanvas, "My Canvas"); 
    }
}

这篇关于WPF:如何在横向模式下打印?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆