/// <summary> /// 메모를 출력한다. /// </summary> public void Print() { if (!IsPrintable()) { MessageBox.Show(nemonic.Properties.Messages.Msg_NoContentError, "Warning", MessageBoxButtons.OK); return; } //Nemonic 프린터를 찾는 과정 ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Printer"); foreach (ManagementObject printer in searcher.Get()) { string printerName = printer["Name"].ToString().ToLower(); if (printerName.Equals("nemonic mip-001")) { if ((bool)printer["WorkOffline"]) { this.ShowPrintDialog(); } else { #if DEBUG //스크린샷 프린트 방식 using (NemonicDocument document = new NemonicDocument(printer["Name"].ToString(), this.CreateGraphics(), this.CurrentPaper, this.LayersCtrl, true)) { document.Print(); } #endif //레이어를 그리는 방식 using (NemonicDocument document = new NemonicDocument(printer["Name"].ToString(), this.CreateGraphics(), this.CurrentPaper, this.LayersCtrl, false)) { document.Print(); } } return; } } this.ShowPrintDialog(); }
private void ShowPrintDialog() { DialogResult rs = MessageBox.Show(nemonic.Properties.Messages.Msg_NoNemonicPrinterError, "", MessageBoxButtons.YesNo); if (rs == DialogResult.Yes) { DialogResult ans = this.printDialog.ShowDialog(); if (ans == DialogResult.OK) { using (NemonicDocument print = new NemonicDocument(this.printDialog.PrinterSettings.PrinterName, this.CreateGraphics(), this.CurrentPaper, this.LayersCtrl, false)) { print.Print(); } } } else { return; } }