Link to home
Start Free TrialLog in
Avatar of C_Sharp_Programmer
C_Sharp_Programmer

asked on

PageSetupDialog.AllowOrientation Not Working

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

Avatar of Daniel Reynolds
Daniel Reynolds
Flag of United States of America image

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
Avatar of C_Sharp_Programmer
C_Sharp_Programmer

ASKER

Thanks for the suggestion, however, PageSettings does not have a property for Portrait mode, only Landscape...
ASKER CERTIFIED SOLUTION
Avatar of C_Sharp_Programmer
C_Sharp_Programmer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial