Solved

PageSetupDialog.AllowOrientation Not Working

Posted on 2009-03-30
3
763 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
  • 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What can cause the styling on a .NET site to not be found? 17 24
Alert on Server memory 2 19
VB.NET 2008 Publish Error 2 25
Winform Module - What is the ASP.Net equiv 2 19
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
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…

808 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