I am running into an issue working with the PageSetupDialog.
I have some fairly simple code (below) that instantiates a PageSetupDialog, assigns a local PrintDocument member variable (which is used to retain the current page setup settings).
If I repeat the following steps over and over:
1) open the PageSetupDialog, 2) choose a different Paper Size, and 3) press [OK]
...the first few times I do this, each time I reopen the PageSetupDialog, things appear to be ok, and it does reflect the most recent Paper Size selection. But if I continue to repeat these steps -- eventually, the PaperSize stops working correctly (e.g. it defaults to Letter when the PageSetupDialog opens, and if I try to choose a different Paper Size and press OK, the underlying m_printDocument.DefaultPageSettings.PaperSize does not reflect the new selection).
I have tried this and run into the same issue with 2 different printers (use "Control Panel > Printers" to set the default printer before running the app).
I have a simple form with a button on it, and the following code:
private void button1_Click(object sender, EventArgs e)
{
PageSetupDialog pageSetupDialog = new PageSetupDialog();
pageSetupDialog.Document = m_printDocument;
pageSetupDialog.ShowDialog();
}
private PrintDocument m_printDocument = new PrintDocument();
This seems to be a bug. Am I not doing things correctly?
Thanks in advance for any assisntance,
Rob