【问题标题】:Printing the currently active window in landscape mode以横向模式打印当前活动窗口
【发布时间】:2012-08-19 06:43:43
【问题描述】:

我想在 C# 中打印当前活动的WinForm。这是我所拥有的:

using Microsoft.VisualBasic.PowerPacks.Printing;

PrintForm p = new PrintForm(this);
p.Print();

这非常适合肖像模式。如何以横向模式打印?

【问题讨论】:

标签: c# winforms printing landscape powerpacks


【解决方案1】:

这行得通吗?

PrintForm p = new PrintForm(this);
p.PrinterSettings.DefaultPageSettings.Landscape = true;
p.Print();

【讨论】:

    【解决方案2】:

    如果您在 VB 中执行此操作,那么您希望以 Orientation 为例

    如果是 C#,我相信你可以进行转换

    If p.Height > p.Width 
    {
        p.Orientation = 1;//vbPRORPortrait
    }
    Else
    {
        p.Orientation = 2; //vbPRORLandscape
    }
    p.Print();
    

    【讨论】:

    • p>方向在 C# 中不可用
    • 如果您使用的是 Microsoft.VisualBasic.PowerPacks.Printing;这就是说您正在使用 VisualBasic 程序集,您应该能够获得该属性..
    • 常数值:vbPRORPortrait = 1, vbPRORLandscape = 2
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-01
    相关资源
    最近更新 更多