private void btnPrintText_Click(object sender, EventArgs e) { if (m_BrDoc.Lines.Count < 1) { MsgBoxHelper.ShowInfo("沒有資料可供列印!"); return; } if (cboPrinters.SelectedIndex < 0) { MsgBoxHelper.ShowInfo("尚未選擇印表機!"); return; } PrintOptions prnOpt = GetPrintOptions(); if (prnOpt == null) { return; } DualPrintHelper prn = new DualPrintHelper(m_BrDoc, prnOpt); prn.PrintText(false); }
/// <summary> /// 直接預覽明眼字,而不顯示列印對話窗。 /// </summary> public void PreviewText() { LoadSettings(); // 載入先前儲存的設定。 if (m_BrDoc.Lines.Count < 1) { MsgBoxHelper.ShowInfo("沒有資料可供列印!"); return; } if (cboPrinters.SelectedIndex < 0) { MsgBoxHelper.ShowInfo("尚未選擇印表機!"); return; } m_DontSaveSettings = true; // 視窗關閉時不要儲存設定 cboPrintTextManualDoubleSide.SelectedIndex = 0; PrintOptions prnOpt = GetPrintOptions(); if (prnOpt == null) { return; } DualPrintHelper prn = new DualPrintHelper(m_BrDoc, prnOpt); prn.PrintText(true); }
private void btnPrintBraille_Click(object sender, EventArgs e) { if (m_BrDoc.Lines.Count < 1) { MsgBoxHelper.ShowInfo("沒有資料可供列印!"); return; } bool isToFile = chkPrintBrailleToFile.Checked; string fileName = txtBrailleFileName.TextBox.Text.Trim(); if (isToFile && String.IsNullOrEmpty(fileName)) { MsgBoxHelper.ShowInfo("請指定欲輸出的檔案名稱。"); txtBrailleFileName.Focus(); return; } if (chkPrintBraille.Checked) { if (String.IsNullOrWhiteSpace(cboPrintersForBraille.Text)) { MessageBox.Show("請指定欲輸出點字的印表機!"); cboPrintersForBraille.Focus(); return; } } PrintOptions prnOpt = GetPrintOptions(); if (prnOpt == null) { return; } DualPrintHelper prn = new DualPrintHelper(m_BrDoc, prnOpt); prn.PrintBraille(chkPrintBraille.Checked, chkPrintBrailleToFile.Checked, fileName); }