Exemple #1
0
        /// <summary>
        /// Відбувається коли закінчується редагування даних
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DataGridViewLine_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            // Міняємо курсор на вид очікування
            this.Cursor = Cursors.AppStarting;

            if ((dataGridViewLine.CurrentCell != null) &&
                (e.ColumnIndex == dataGridViewLine.Columns.Count - 1))
            {
                // ключ для редагування словника ліній
                int key = int.Parse(dataGridViewLine.Rows[e.RowIndex].HeaderCell.Value.ToString());
                // встановлене користувачем значення
                bool value = bool.Parse(dataGridViewLine.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
                // корегуємо масив даних
                markerLine.CorrectLine(key, value);
                // витягаємо дані із зображення, відповідно до вибраного користувачем значення
                if (value && (img.imageCorect != null))
                {
                    PointsOfLine = null;
                    // отримуємо дані із зображення
                    //pointsOfLine = img.GetPixelFromLine(markerLine.LineDict[key], img.imageCorect);
                    PointsOfLine = img.GetPixelFromLine(markerLine.LineDict[key], img.imageCorect);
                    // будуємо таблицю
                    TableShowGraph(PointsOfLine, dataGridViewGraph);
                    // будуємо графік
                    pictureBoxGraph.Refresh();
                }
                else
                {
                    GraphClear();
                }
            }

            // Повертаємо курсор назад
            this.Cursor = Cursors.Default;
        }