/// <summary> /// Shows advanced printer settings /// </summary> /// <param name="owner"></param> /// <param name="printerName"></param> public void ShowAdvancedPrinterSettings(Form owner, string printerName, ref PrinterSettings settings) { if (settings == null || !settings.IsValid) { LogHelper.LogDebug("Invalid printer settings for " + printerName); return; } LogHelper.LogDebug(); try { PrinterSettings ps = new PrinterSettings(); ps = settings; // show printer settings if (PrintDialogHelper.EditPrinterSettings(ps, owner.Handle) == DialogResult.OK) { // save printer settings LogHelper.LogDebug("Printer settings changed"); settings = ps; } } catch (Exception ex) { Notifier.Error(ex); } }
/// <summary> /// Shows advanced printer settings /// </summary> /// <param name="handle">window handle</param> /// <param name="printerName">printer name</param> /// <param name="settings">settings</param> public void ShowAdvancedPrinterSettings(IntPtr handle, string printerName, ref System.Drawing.Printing.PrinterSettings settings) { // check the printer settings if (settings == null || !settings.IsValid) { LogHelper.LogDebug("Invalid printer settings for " + printerName); return; } LogHelper.LogDebug(); try { // create new printer settings System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings(); // set new settings as an old one ps = settings; // show printer settings window as dialog for the current window if (PrintDialogHelper.EditPrinterSettings(ps, handle) == System.Windows.Forms.DialogResult.OK) { LogHelper.LogDebug("Printer settings changed"); // save changed printer settings settings = ps; } } catch (Exception ex) { WPFNotifier.Error(ex); } }