コード例 #1
0
 private void SchedularView_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
 {
     // end of edition on each click on column of checkbox
     if (e.RowIndex == -1)
     {
         return;
     }
     switch (e.ColumnIndex)
     {
     case SCHEDULE_COL_ACTIVE:
     case SCHEDULE_COL_SUCCESS:
     case SCHEDULE_COL_ERROR:
         SchedularView.EndEdit();
         break;
     }
 }
コード例 #2
0
        private void SchedularView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == -1 || e.RowIndex == -1)
            {
                return;
            }

            SchedularView.CurrentCell = SchedularView[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)SchedularView[e.ColumnIndex, e.RowIndex].Tag;
                if (!string.IsNullOrWhiteSpace(fullName))
                {
                    dialog.InitialDirectory = Path.GetDirectoryName(fullName);
                    dialog.FileName         = Path.GetFileName(fullName);
                }

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

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