Solved

PageSetupDialog.AllowOrientation Not Working

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

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:…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

622 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