2

I want to print the currently active WinForm in C#. Here is what I have:

using Microsoft.VisualBasic.PowerPacks.Printing;

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

This works great for portrait mode. How can I print in landscape mode?

DavidRR
  • 18,291
  • 25
  • 109
  • 191
software is fun
  • 7,286
  • 18
  • 71
  • 129
  • I did a google search and came up with this http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.powerpacks.printing.compatibility.vb6.printer.orientation.aspx – MethodMan Aug 23 '12 at 17:18

2 Answers2

2

Does this work?

PrintForm p = new PrintForm(this);
p.PrinterSettings.DefaultPageSettings.Landscape = true;
p.Print();
staafl
  • 3,147
  • 1
  • 28
  • 23
0

if you are doing this in VB then you want to look at Orientation as an example

if it's C# I am sure you can do the conversion

If p.Height > p.Width 
{
    p.Orientation = 1;//vbPRORPortrait
}
Else
{
    p.Orientation = 2; //vbPRORLandscape
}
p.Print();
MethodMan
  • 18,625
  • 6
  • 34
  • 52