private void dgvBulkPDF_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { var fieldOptionForm = new FieldOptionForm(new Point(this.Location.X + Convert.ToInt32(this.Width / 2.5), this.Location.Y + Convert.ToInt32(this.Height / 2.5)) , pdfFields[(string)dgvBulkPDF.Rows[e.RowIndex].Cells["ColField"].Value], dataSource.Columns); fieldOptionForm.ShowDialog(); if (fieldOptionForm.ShouldBeSaved) { pdfFields[fieldOptionForm.PDFField.Name] = fieldOptionForm.PDFField; if (fieldOptionForm.PDFField.UseValueFromDataSource) { string value = pdfFields[fieldOptionForm.PDFField.Name].DataSourceValue; if (pdfFields[fieldOptionForm.PDFField.Name].MakeReadOnly) { value = "[#]" + value; } dgvBulkPDF.Rows[e.RowIndex].Cells["ColValue"].Value = value; } else { dgvBulkPDF.Rows[e.RowIndex].Cells["ColValue"].Value = pdfFields[fieldOptionForm.PDFField.Name].CurrentValue; } } } }
private void dgvBulkPDF_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { var fieldOptionForm = new FieldOptionForm(new Point(this.Location.X + Convert.ToInt32(this.Width / 2.5), this.Location.Y + Convert.ToInt32(this.Height / 2.5)) , pdfFields[(string)dgvBulkPDF.Rows[e.RowIndex].Cells["ColField"].Value], dataSource.Columns); fieldOptionForm.ShowDialog(); if (fieldOptionForm.ShouldBeSaved) { pdfFields[fieldOptionForm.PDFField.Name] = fieldOptionForm.PDFField; if (fieldOptionForm.PDFField.UseValueFromDataSource) { string value = pdfFields[fieldOptionForm.PDFField.Name].DataSourceValue; if (pdfFields[fieldOptionForm.PDFField.Name].MakeReadOnly) value = "[#]" + value; dgvBulkPDF.Rows[e.RowIndex].Cells["ColValue"].Value = value; } else { dgvBulkPDF.Rows[e.RowIndex].Cells["ColValue"].Value = pdfFields[fieldOptionForm.PDFField.Name].CurrentValue; } } } }