Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Landscape and Portrait printing in the same document

0 views
Skip to first unread message

Rick Hein

unread,
Feb 13, 2003, 6:50:03 PM2/13/03
to
Don't know if this is the right place to ask this question, but here goes. I
have an application that needs to have some reports printed from it. Some of
the pages I want to be in portrait mode, and some I want in Landscape mode.
Setting the document.DefaultPageSettings.Landscape = true or false doesn't
seem to have any affect.

The C# code looks something like this
private void button2_Click(object sender, System.EventArgs e)

{

PrintDialog pd = new PrintDialog();

pd.Document = doc;

pd.ShowDialog();

doc.PrinterSettings.Equals(pd.PrinterSettings);


iTabCount = 0;

currentPage = 1;

doc.Print();

}

private void doc_PrintPage(object
sender,System.Drawing.Printing.PrintPageEventArgs ev)

{

if(foo== bar){

document.DefaultPageSettings.Landscape = true;

}

else

{

document.DefaultPageSettings.Landscape =false;

}

Drawstring ......

}

This is pseudocode granted, but you get the idea. For some reason however it
doesn't make any difference, any ideas on how I can do this? Other than a
rotateTransform and Translate Transform? Or is this a limit of the printer
drivers - A document can only be portrait or only landscape but not both?

thanks

Rick Hein

rh...@mutualofenumclaw.com


Greg Binkerd [MS]

unread,
Feb 17, 2003, 1:38:36 PM2/17/03
to
Hi.

You might want to look at the QueryPageSettings event and direct a new page
orientation/make modifications to the one used. This event occurs before
PrintPage.


Thanks,
-Greg
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Visit http://www.microsoft.com/security for current information on security.


--------------------
| From: "Rick Hein" <rh...@mutualofenumclaw.com>
| Subject: Landscape and Portrait printing in the same document
| Date: Thu, 13 Feb 2003 15:50:03 -0800
| Lines: 67
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <uMkvVq70CHA.2904@TK2MSFTNGP09>
| Newsgroups: microsoft.public.dotnet.framework.drawing
| NNTP-Posting-Host: 208.152.20.165
| Path: cpmsftngxa08!cpmsftngxa06!TK2MSFTNGP08!TK2MSFTNGP09
| Xref: cpmsftngxa08 microsoft.public.dotnet.framework.drawing:5452
| X-Tomcat-NG: microsoft.public.dotnet.framework.drawing

Rick Hein

unread,
Jan 19, 2005, 2:01:09 PM1/19/05
to
To the gentleman that called me today: (1/19/2005) - Please call me
back - I think I might have an answer to your problem.

Thanks.
Rick

Bob Powell [MVP]

unread,
Jan 19, 2005, 9:08:47 PM1/19/05
to
Hey Rick.
Don't keep it a secret, Some of us have a FAQ to maintain :-))

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Rick Hein" <Rick...@gmail.com> wrote in message
news:1106161269....@z14g2000cwz.googlegroups.com...

Andrew Smith (Infragistics)

unread,
Jan 22, 2005, 1:12:13 PM1/22/05
to
I'm not sure why he didn't post it but the answer is to use the
QueryPageSettings event and alter the PageSettings passed into the event. By
the time that the PrintPage event is invoked, the page/hdc is already
created so its too late to try and manipulate the page settings.
QueryPageSettings is invoked before each page is printed. Note: the .net
print preview control will not properly display these pages although they
will print fine.

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:ObtfXUp$EHA....@TK2MSFTNGP15.phx.gbl...

0 new messages