Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用c#Winforms WebBrowser控件将打印方向设置为横向_C#_Winforms_Printing - Fatal编程技术网

使用c#Winforms WebBrowser控件将打印方向设置为横向

使用c#Winforms WebBrowser控件将打印方向设置为横向,c#,winforms,printing,C#,Winforms,Printing,我需要在winforms应用程序中以编程方式更改其中一个webbrowser控件的打印方向。从我在其他帖子上读到的。。。看起来唯一的方法是通过编程注册表编辑、打印,然后重新更改注册表 这是唯一的解决办法吗?如果是这样,有人能在代码中提供正确的方法吗?您是否尝试过: printDialog.Document.DefaultPageSettings.横向=true 我想。。。以下是如何在WPF中完成的: var dialog = new PrintDialog(); if (dialog.Sho

我需要在winforms应用程序中以编程方式更改其中一个webbrowser控件的打印方向。从我在其他帖子上读到的。。。看起来唯一的方法是通过编程注册表编辑、打印,然后重新更改注册表

这是唯一的解决办法吗?如果是这样,有人能在代码中提供正确的方法吗?

您是否尝试过:
printDialog.Document.DefaultPageSettings.横向=true

我想。。。以下是如何在WPF中完成的:

var dialog = new PrintDialog(); 

if (dialog.ShowDialog() == true) 
{
     System.Printing.PrintTicket pt = dialog.PrintTicket;
     pt.PageOrientation = System.Printing.PageOrientation.Landscape;

     dialog.PrintTicket = pt;

     // Print the element. 
     dialog.PrintVisual(ReportContentPresenter, "Report"); 
} 
奇怪的是,在System.PrintTicket中找不到PrintTicket,即使在添加对此DLL的引用后也无法打印。您还必须添加ReachFramework的引用,才能在IntelSense中获取PrintTicket。。微软从不停止从简单的事情中创造神秘的事物。。!!享受吧