Example #1
0
        private void btnProperties_Click(object sender, EventArgs e)
        {
            string buttonPressed    = (sender as Button).Name;
            string buttonIndex      = buttonPressed[buttonPressed.Length - 1].ToString();
            int    pdfDocumentIndex = -1;

            if (int.TryParse(buttonIndex, out pdfDocumentIndex))
            {
                pdfDocumentIndex--;
                if (pdfDocumentIndex > -1 && pdfDocumentIndex < 5)
                {
                    if (pdfPrintPropertiesForms[pdfDocumentIndex] == null)
                    {
                        pdfPrintPropertiesForms[pdfDocumentIndex] = new PDFPrintPropertiesForm(cmbxPrinterNames.SelectedItem.ToString(), pdfDocumentIndex);
                        if (_printerInfo == null)
                        {
                            _printerInfo = PdfPrintTest.GetPrinterInfo(cmbxPrinterNames.SelectedItem.ToString());
                        }
                        pdfPrintPropertiesForms[pdfDocumentIndex].ApplyPrinterInfo(_printerInfo);
                        pdfPrintPropertiesForms[pdfDocumentIndex].ShowDialog();
                    }
                    else
                    {
                        pdfPrintPropertiesForms[pdfDocumentIndex].ShowDialog();
                    }
                }
            }
        }
Example #2
0
        private void cmbxPrinterNames_SelectedIndexChanged(object sender, EventArgs e)
        {
            _printerInfo = PdfPrintTest.GetPrinterInfo(cmbxPrinterNames.SelectedItem.ToString());

            foreach (PDFPrintPropertiesForm form in pdfPrintPropertiesForms)
            {
                if (form != null)
                {
                    form.ApplyPrinterInfo(_printerInfo);
                }
            }
        }