Solved

PageSetupDialog.AllowOrientation Not Working

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

830 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