private void GridViewStartProgramCellContentClick(object sender, DataGridViewCellEventArgs e) { var grid = (DataGridView)sender; if (grid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { if (e.ColumnIndex == 3) { var cellTitle = grid.Rows[e.RowIndex].Cells[0]; var cellFileName = grid.Rows[e.RowIndex].Cells[1]; var cellArguments = grid.Rows[e.RowIndex].Cells[2]; var dialog = new StartProgramForm(cellTitle.Value.ToString(), cellFileName.Value.ToString(), cellArguments.Value.ToString()); if (dialog.ShowDialog(this) == DialogResult.OK) { cellTitle.Value = dialog.Title; cellFileName.Value = dialog.FileName; cellArguments.Value = dialog.Arguments; } } if (e.ColumnIndex == 4) { grid.Rows.RemoveAt(e.RowIndex); } } }
private void GridViewStartProgramCellContentClick(object sender, DataGridViewCellEventArgs e) { var grid = (DataGridView)sender; if (grid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { var row = grid.Rows[e.RowIndex]; if (e.ColumnIndex == 3 && row.Tag is StartProgramMenuItem menuItem) { var dialog = new StartProgramForm(menuItem, _settings.Language); if (dialog.ShowDialog(this) == DialogResult.OK) { row.Cells[0].Value = dialog.MenuItem.Title; row.Cells[1].Value = dialog.MenuItem.FileName; row.Cells[2].Value = dialog.MenuItem.Arguments; row.Tag = dialog.MenuItem; } } if (e.ColumnIndex == 4) { grid.Rows.RemoveAt(e.RowIndex); } } }
private void ButtonAddStartProgramClick(object sender, EventArgs e) { var dialog = new StartProgramForm("", "", ""); if (dialog.ShowDialog(this) == DialogResult.OK) { var index = gvStartProgram.Rows.Add(); var row = gvStartProgram.Rows[index]; row.Cells[0].Value = dialog.Title; row.Cells[1].Value = dialog.FileName; row.Cells[2].Value = dialog.Arguments; row.Cells[3].ToolTipText = "Edit"; row.Cells[4].ToolTipText = "Delete"; } }
private void ButtonAddStartProgramClick(object sender, EventArgs e) { var dialog = new StartProgramForm("", "", "", _settings); if (dialog.ShowDialog(this) == DialogResult.OK) { var index = gvStartProgram.Rows.Add(); var row = gvStartProgram.Rows[index]; row.Cells[0].Value = dialog.Title; row.Cells[1].Value = dialog.FileName; row.Cells[2].Value = dialog.Arguments; row.Cells[3].ToolTipText = _settings.LanguageSettings.GetValue("clm_start_program_edit"); row.Cells[4].ToolTipText = _settings.LanguageSettings.GetValue("clm_start_program_delete"); } }
private void GridViewStartProgramCellDoubleClick(object sender, DataGridViewCellEventArgs e) { var grid = (DataGridView)sender; var row = grid.Rows[e.RowIndex]; if ((e.ColumnIndex == 0 || e.ColumnIndex == 1 || e.ColumnIndex == 2) && e.RowIndex >= 0 && row.Tag is StartProgramMenuItem menuItem) { var dialog = new StartProgramForm(menuItem, _settings.Language); if (dialog.ShowDialog(this) == DialogResult.OK) { row.Cells[0].Value = dialog.MenuItem.Title; row.Cells[1].Value = dialog.MenuItem.FileName; row.Cells[2].Value = dialog.MenuItem.Arguments; row.Tag = dialog.MenuItem; } } }
private void GridViewStartProgramCellDoubleClick(object sender, DataGridViewCellEventArgs e) { var grid = (DataGridView)sender; if ((e.ColumnIndex == 0 || e.ColumnIndex == 1 || e.ColumnIndex == 2) && e.RowIndex >= 0) { var cellTitle = grid.Rows[e.RowIndex].Cells[0]; var cellFileName = grid.Rows[e.RowIndex].Cells[1]; var cellArguments = grid.Rows[e.RowIndex].Cells[2]; var dialog = new StartProgramForm(cellTitle.Value.ToString(), cellFileName.Value.ToString(), cellArguments.Value.ToString()); if (dialog.ShowDialog(this) == DialogResult.OK) { cellTitle.Value = dialog.Title; cellFileName.Value = dialog.FileName; cellArguments.Value = dialog.Arguments; } } }