Exemplo n.º 1
0
        private void SchedulerView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == -1 || e.RowIndex == -1)
            {
                return;
            }

            SchedulerView.CurrentCell = SchedulerView[e.ColumnIndex, e.RowIndex];

            switch (e.ColumnIndex)
            {
            case SCHEDULE_COL_ACTIVE:
                break;

            case SCHEDULE_COL_FILE:
                // select file
                OpenFileDialog dialog   = new OpenFileDialog();
                string         fullName = (string)SchedulerView[e.ColumnIndex, e.RowIndex].Tag;
                if (!string.IsNullOrWhiteSpace(fullName))
                {
                    dialog.InitialDirectory = Path.GetDirectoryName(fullName);
                    dialog.FileName         = Path.GetFileName(fullName);
                }

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    SchedulerView[e.ColumnIndex, e.RowIndex].Tag   = dialog.FileName;
                    SchedulerView[e.ColumnIndex, e.RowIndex].Value = Path.GetFileName(dialog.FileName);
                }
                break;

            case SCHEDULE_COL_DATE:
            case SCHEDULE_COL_TIME:
            case SCHEDULE_COL_DEST:
                SchedulerView.BeginEdit(true);
                //((TextBox)dataGridView1.EditingControl).SelectionStart = dataGridView1.CurrentCell.Value.ToString().Length;
                break;
            }
        }