Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void showData(List<Item> collection)
- {
- gwQuestions.AutoGenerateColumns = false;
- gwQuestions.DataSource = addNotSet(collection);
- foreach (DataGridViewRow row in gwQuestions.Rows)
- {
- DataGridViewImageCell cell = row.Cells[2] as DataGridViewImageCell;
- cell.ValueType = typeof(System.Drawing.Image);
- if (collection[row.Index].Result)
- {
- cell.Value = (System.Drawing.Image)Properties.Resources.Check;
- }
- else
- {
- cell.Value = (System.Drawing.Image)Properties.Resources.Cancel;
- }
- }
- }
- dataGridView1.CellFormatting += dataGridView1_CellFormatting;
- void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
- {
- if (dataGridView1.Columns[e.ColumnIndex].Name == "ImageColumnName")
- {
- if (collection[e.RowIndex].Result)
- {
- e.Value = (System.Drawing.Image)Properties.Resources.Check;
- }
- else
- {
- e.Value = (System.Drawing.Image)Properties.Resources.Cancel;
- }
- }
- }
Add Comment
Please, Sign In to add comment