コード例 #1
0
        /// <summary>
        /// 列印點字。
        /// </summary>
        public void PrintBraille(bool toBrailler, bool toFile, string fileName)
        {
            if (toBrailler == false && toFile == false)
            {
                return;
            }

            string msg = "請按「確定」鈕開始列印點字。";

            if (toFile)
            {
                msg = "請按「確定」鈕開始將點字資料輸出至以下檔案:\r\n" + fileName;
            }
            if (MsgBoxHelper.ShowOkCancel(msg) != DialogResult.OK)
            {
                return;
            }

            bool cancel = false;

            // 起始列印工作
            BeginPrintBraille(ref cancel);
            if (cancel)
            {
                return;
            }

            StringBuilder brailleData = GenerateOutputData();

            if (toBrailler)
            {
                WriteToBrailler(brailleData);   // 輸出至點字印表機
            }
            if (toFile)
            {
                WriteToFile(brailleData, fileName); // 輸出至檔案
            }

            // 收尾列印工作
            EndPrintBraille(toBrailler, toFile);
        }
コード例 #2
0
        internal void DeleteLine(int row, int col, bool needConfirm)
        {
            // 防錯:如果不是有效的儲存格位置就直接返回。
            if (!CheckCellPosition(row, col))
            {
                return;
            }

            // 選取欲刪除的列,讓使用者容易知道。
            SourceGrid.Position activePos = brGrid.Selection.ActivePosition;
            GridSelectRow(row, true);

            if (needConfirm && MsgBoxHelper.ShowOkCancel("確定要刪除整列?") != DialogResult.OK)
            {
                GridSelectRow(row, false);
                GridFocusCell(activePos, true);
                return;
            }

            row = GetBrailleRowIndex(row);  // 確保列索引為點字列。

            int         lineIdx = GetBrailleLineIndex(row);
            BrailleLine brLine  = m_BrDoc.Lines[lineIdx];

            brLine.Clear();
            brLine = null;
            m_BrDoc.Lines.RemoveAt(lineIdx);

            OnDataChanged();

            // 更新 UI。
            brGrid.Rows.RemoveRange(row, 3);

            RefreshRowNumbers();

            GridSelectRow(row, false);
            GridFocusCell(activePos, true);
        }