Solved

PageSetupDialog.AllowOrientation Not Working

Posted on 2009-03-30
3
774 Views
Last Modified: 2013-12-17
Whenever I set the AllowOrientation property of a PageSetupDialog to 'true', it still doesn't allow the user to change the orientation of a document (meaning that the option for 'Landscape' isn't enabled).  However, if I set PageSettings.Landscape (on the PageSetupDialog) to 'true', then when the PageSetupDialog box comes up, the document is set to Landscape, and you can toggle back and forth between portrait and landscape modes.  However, I can't default my document to landscape as many users will want the document to be printed in portrait mode by default.

So am I missing something simple here?  Thanks!  Below is the code I'm using:
PageSetupDialog dlg = new PageSetupDialog();
            dlg.Document = doc; //in this case, 'doc' is a PrintDocument
            dlg.AllowOrientation = true;  //this does not work!!!
 
            //if the following line is un-commented, the orientation can be changed, but it defaults to
            //landscape, which is unacceptable for my project.
            //dlg.PageSettings.Landscape = true;
            dlg.EnableMetric = true;
            dlg.ShowDialog();

Open in new window

0
Comment
Question by:C_Sharp_Programmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 17

Expert Comment

by:Daniel Reynolds
ID: 24022431
Have you tried setting the setting to Portrait? to see if it then allows toggling, much like setting it to Landscape did for you? Sounds and is stupid, but if it does the trick...

dlg.PageSettings.Portrait = true
0
 
LVL 4

Author Comment

by:C_Sharp_Programmer
ID: 24022457
Thanks for the suggestion, however, PageSettings does not have a property for Portrait mode, only Landscape...
0
 
LVL 4

Accepted Solution

by:
C_Sharp_Programmer earned 0 total points
ID: 24029730
It appears that the AllowOrientation property only takes effect if your selected printer supports it (although setting the Landscape property to true seems to force-override this).  Once I selected a different printer, it worked fine.

Hope this helps someone else who might run into this problem!
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question