Ejemplo n.º 1
0
 private void FillLeadtoolsPrintersList()
 {
     try
     {
         _cmbPrintersList.Items.Clear();
         _cmbPrintersList.Items.AddRange(PrintingUtilities.GetLeadtoolsPrintersList());
         _cmbPrintersList.SelectedIndex = 0;
         EnableControls();
     }
     catch (Exception Ex)
     {
         MessageBox.Show(Ex.ToString(), "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Ejemplo n.º 2
0
        private void FillLeadtoolsPrintersList()
        {
            string setupPrinter = string.Empty;

            if (Is64Bit())
            {
                setupPrinter = "LEADTOOLS .NET Printer 64-bit";
            }
            else
            {
                setupPrinter = "LEADTOOLS .NET Printer 32-bit";
            }

#if LTV20_CONFIG
            if (Is64Bit())
            {
                setupPrinter = "LEADTOOLS 20 .NET Printer 64-bit";
            }
            else
            {
                setupPrinter = "LEADTOOLS 20 .NET Printer 32-bit";
            }
#endif

            try
            {
                _cmbPrintersList.Items.Clear();
                _cmbPrintersList.Items.AddRange(PrintingUtilities.GetLeadtoolsPrintersList());

                if (_cmbPrintersList.Items.Count > 0)
                {
                    if (_printerName != string.Empty)
                    {
                        _cmbPrintersList.Text = _printerName;
                    }
                    else
                    {
                        _cmbPrintersList.SelectedIndex = 0;
                    }

                    if (_printerName == string.Empty)
                    {
                        for (int i = 0; i < _cmbPrintersList.Items.Count; i++)
                        {
                            if ((_cmbPrintersList.Items[i] as string).ToLower() == setupPrinter.ToLower())
                            {
                                _cmbPrintersList.SelectedIndex = i;
                            }
                        }
                    }
                }
                else
                {
                    string errorMessage = "No printers are available.";
                    MessageBox.Show(errorMessage, "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                EnableControls();
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.ToString(), "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }