Correction: you can set it, but the intellisense set "Gets" and I just took
it literally. Apologies.
Here is the code I have:
private void linkLabel_asd_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e)
{
PrintDocument document = new PrintDocument();
document.PrinterSettings.DefaultPageSettings.Print erResolution.X = 300;
document.PrinterSettings.DefaultPageSettings.Print erResolution.Y = 300;
document.PrintPage += new PrintPageEventHandler(document_PrintPage);
printPreviewDialog1.Document = document;
printPreviewDialog1.ShowDialog();
}
private void document_PrintPage(object sender, PrintPageEventArgs e)
{
e.PageSettings.PrinterResolution.X = 300;
e.PageSettings.PrinterResolution.Y = 300;
e.PageSettings.PrinterSettings.DefaultPageSettings .PrinterResolution.X =
300;
BuildSNLabelGenerator gen = new BuildSNLabelGenerator();
gen.GenerateLabelSheets(e.Graphics, new SizeF(1.78F, 0.50F),
e.MarginBounds, true);
// Image image = gen.GenerateLabelSheets(true);
// e.Graphics.DrawImage(image, new Point(0, 0));
}
e.PageBounds is still returning 850 x 1100
Any ideas?
I have tried setting the PrinterDocument resolution to 300x300 and tried the
"Steve" <sk**@skle.com> wrote in message
news:Oz**************@TK2MSFTNGP04.phx.gbl...
I'm trying real hard to set the printer resolution for a PrintDocument.
It appears that the printer is already set to 300 x 300 dpi, which is JUST
what I want.
But the Margins and PrintableArea properties of the PageSettings in the
Print handler are reporting values that indicate 100 dpi, for example it
reports PaperSize as 850, 1100 (8.5" x 11")
I'm passing these Rectangle properties into a method that is drawing
thinking it's working on a 300 DPI Image, so if it gets a Graphics context
that is 100dpi, everything is out of bounds.
What I don't understand is why the MSDN docs say you can set the printer
resolution with the PrinterResolution property of the pageSettings class,
but there is no Set accessor for the X and Y Properties.
I'm trying not to get frustrated, but this just seems so mixed up.
Do I need to set the resolution on the PrintDocument I've created? Can
someone please give me some tips on how to draw to a printer (is that what
you call it?) at 300 DPI?
Thanks for reading,
Steve