コード例 #1
0
        private void _miInstallPrinter_Click(object sender, EventArgs e)
        {
            try
            {
                FrmInstallPrinter frmInstallPrinter = new FrmInstallPrinter();
                DialogResult      dialogResult      = frmInstallPrinter.ShowDialog();

                if (dialogResult == DialogResult.OK)
                {
                    string newPrinterName     = frmInstallPrinter.PrinterName;
                    string newPrinterPassword = frmInstallPrinter.PrinterPassword;

                    bool bSuccess = PrintingUtilities.InstallNewPrinter(newPrinterName, newPrinterPassword);

                    if (bSuccess)
                    {
                        _currentPrinterName = newPrinterName;
                        SetCurrentPrinter();
                    }
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
コード例 #2
0
ファイル: FrmGetPrinterName.cs プロジェクト: sakpung/webstudy
        private void _btnInstallNewPrinter_Click(object sender, EventArgs e)
        {
            try
            {
                FrmInstallPrinter frmInstallPrinter = new FrmInstallPrinter();
                DialogResult      dialogResult      = frmInstallPrinter.ShowDialog();

                if (dialogResult == DialogResult.OK)
                {
                    Cursor = Cursors.WaitCursor;
                    string newPrinterName     = _printerName = frmInstallPrinter.PrinterName;
                    string newPrinterPassword = frmInstallPrinter.PrinterPassword;

                    PrintingUtilities.InstallNewPrinter(newPrinterName, newPrinterPassword);
                    _printerName = newPrinterName;
                    FillLeadtoolsPrintersList();
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.ToString(), "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }