G
Guest
Hi,
I am trying to alter the the printDialog properties programatically and
appear to be unable to. In the code below, I am changing the default paper
size to Legal. However, it always changes back to letter. If I change the
paper size in the dialog, it works as expected. I also tried to change the
paper size in the document.QueryPageSettings event with the same results.
If someone has a suggestion as to what I may be missing, I would appreciate
it!
Thanks,
Craig Adams
Vivus Software, Inc.
Dim legal As System.drawing.Printing.PaperSize = New
System.Drawing.Printing.PaperSize("Legal", 850, 1400)
' Allow the user to choose the printer and settings.
_printDialog = New PrintDialog
_printDialog.Document = _receiptDocument
With _printDialog
.AllowSomePages = True
'.AllowSelection = True
.PrinterSettings.DefaultPageSettings.PaperSize = legal
.Document = _receiptDocument
.Document.DefaultPageSettings.PaperSize = legal
.Document.PrinterSettings.DefaultPageSettings.PaperSize = legal
End With
Dim Result As DialogResult = _printDialog.ShowDialog()
If Result = DialogResult.OK Then
_printMode = False
_receiptDocument.PrinterSettings.PrinterName =
_printDialog.PrinterSettings.PrinterName
_receiptDocument.Print()
End If
I am trying to alter the the printDialog properties programatically and
appear to be unable to. In the code below, I am changing the default paper
size to Legal. However, it always changes back to letter. If I change the
paper size in the dialog, it works as expected. I also tried to change the
paper size in the document.QueryPageSettings event with the same results.
If someone has a suggestion as to what I may be missing, I would appreciate
it!
Thanks,
Craig Adams
Vivus Software, Inc.
Dim legal As System.drawing.Printing.PaperSize = New
System.Drawing.Printing.PaperSize("Legal", 850, 1400)
' Allow the user to choose the printer and settings.
_printDialog = New PrintDialog
_printDialog.Document = _receiptDocument
With _printDialog
.AllowSomePages = True
'.AllowSelection = True
.PrinterSettings.DefaultPageSettings.PaperSize = legal
.Document = _receiptDocument
.Document.DefaultPageSettings.PaperSize = legal
.Document.PrinterSettings.DefaultPageSettings.PaperSize = legal
End With
Dim Result As DialogResult = _printDialog.ShowDialog()
If Result = DialogResult.OK Then
_printMode = False
_receiptDocument.PrinterSettings.PrinterName =
_printDialog.PrinterSettings.PrinterName
_receiptDocument.Print()
End If