R
Robert Hooker
Hi,
I'm curious to know if I'm doing something wrong here, or if this is just
mind-numbingly slow for a reason.
In a simple WindowsFormsApplication:
public Form1()
{
// Required for Windows Form Designer support
InitializeComponent();
PrintDocument printDoc = new PrintDocument();
// Add each papersize name (string) to an array
//
// Querying printer for all its papersizes is **Slow**
// - This loop takes about 8 seconds (!!) to execute on my machine for 14
sizes
ArrayList names = new ArrayList();
PrinterSettings printer = printDoc.PrinterSettings;
for( int i=0; i<printer.PaperSizes.Count; i++ )
{
PaperSize psize = printer.PaperSizes;
names.Add(psize.PaperName);
}
}
It appears that each call to printer.PaperSizes.xxxxx takes a very VERY long
time. I can speed that loop up by moving the printer.PaperSizes.Count up out
of the loop, but having to do this seems funky.
Am I missing something, or is this stuff just broken for speed?
Rob.
I'm curious to know if I'm doing something wrong here, or if this is just
mind-numbingly slow for a reason.
In a simple WindowsFormsApplication:
public Form1()
{
// Required for Windows Form Designer support
InitializeComponent();
PrintDocument printDoc = new PrintDocument();
// Add each papersize name (string) to an array
//
// Querying printer for all its papersizes is **Slow**
// - This loop takes about 8 seconds (!!) to execute on my machine for 14
sizes
ArrayList names = new ArrayList();
PrinterSettings printer = printDoc.PrinterSettings;
for( int i=0; i<printer.PaperSizes.Count; i++ )
{
PaperSize psize = printer.PaperSizes;
names.Add(psize.PaperName);
}
}
It appears that each call to printer.PaperSizes.xxxxx takes a very VERY long
time. I can speed that loop up by moving the printer.PaperSizes.Count up out
of the loop, but having to do this seems funky.
Am I missing something, or is this stuff just broken for speed?
Rob.