コード例 #1
0
        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);
        }
コード例 #2
0
        /// <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);
        }