An in house application that I'm developing is behaving strange on a Windows 7 (64 bit) PC.
If I create an instance of a PrintDialog, and call it's ShowDialog() method, the method immediately returns DialogResult.Cancel without showing the printer dialog form.
The Windows 7 PC does have printers installed (with a working default printer).
PrintDialog printDialog = new PrintDialog();
printDialog.PrinterSettings.Copies = 2;
printDialog.AllowCurrentPage = false;
printDialog.AllowPrintToFile = false;
printDialog.AllowSelection = false;
printDialog.AllowSomePages = false;
DialogResult dialogResult = printDialog.ShowDialog(this);
if (dialogResult == DialogResult.Cancel)
return;
Any clues why this is happening?
Set
printDialog.UseEXDialog
totrue
to work around this bug.In .Net 3.5, MSDN mentions this potential problem when documenting
UseEXDialog
:(My emphasis.)
The same page for .Net 4 and .Net 4.5 don't include the emphasized bit, so perhaps it's fixed in those versions.