Solved

PageSetupDialog.AllowOrientation Not Working

Posted on 2009-03-30
3
759 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:xDJR1875
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now