[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

Re: Landscape and Portrait printing in the same document

Rick Hein

1/19/2005 7:01:00 PM

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



Rick Hein wrote:
> 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
>
> rhein@mutualofenumclaw.com

3 Answers

Bob Powell

1/20/2005 2:09:00 AM

0

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/tips...

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

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





"Rick Hein" <RickJHein@gmail.com> wrote in message
news:1106161269.412641.86710@z14g2000cwz.googlegroups.com...
> 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
>
>
>
> Rick Hein wrote:
>> 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
>>
>> rhein@mutualofenumclaw.com
>


Tim Hitchings \(Infragistics\)

1/22/2005 6:12:00 PM

0

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.3924@TK2MSFTNGP15.phx.gbl...
> 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/tips...
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/f...
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "Rick Hein" <RickJHein@gmail.com> wrote in message
> news:1106161269.412641.86710@z14g2000cwz.googlegroups.com...
>> 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
>>
>>
>>
>> Rick Hein wrote:
>>> 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
>>>
>>> rhein@mutualofenumclaw.com
>>
>
>


Patriot Games

3/21/2010 5:05:00 PM

0

On Sat, 20 Mar 2010 13:14:07 -0400, Just Visiting
<nospam-webextra@sbcglobal.net> wrote:
>On Sat, 20 Mar 2010 13:06:41 -0400, Patriot Games
><Patriot@america.com> wrote:
>>On Sat, 20 Mar 2010 11:31:08 -0400, Just Visiting
>><nospam-webextra@sbcglobal.net> wrote:
>>>Next, arrest EVERYONE that has said the "N" word.
>>Did your Buckwheat PresiChimp repeal the 1st Amendment or did you trip
>>and hit your head while picking through the dumpster looking for
>>breakfast while waiting for more government cheese?
>Settle down now. It's sarcastic!

http://www.youtube.com/watch?v=V...