I have a complete dataGridView with 5 Columns.
Now, I want to draw a Bitmap in certains cells of these columns.
This is what it should look like:
I've currently tried:
dataGridView1.Rows.Add( ) ;
Can you help me to draw a bitmap in new Row of dataGridView.Rows?
Try this:
dataGridView1.Columns.Add("columnName1", "Column 1 Header");
dataGridView1.Columns.Add("columnName2", "Column 2 Header");
var row1 = new DataGridViewRow();
row1.Cells.Add(new DataGridViewImageCell { Value = new Bitmap(@"C:\Path\to\image.jpg") });
row1.Cells.Add(new DataGridViewTextBoxCell { Value = "string" });
dataGridView1.Rows.Add(row1);
var row2 = new DataGridViewRow();
row2.Cells.Add(new DataGridViewTextBoxCell { Value = "string"});
row2.Cells.Add(new DataGridViewImageCell { Value = new Bitmap(@"C:\Path\to\image.jpg") });
dataGridView1.Rows.Add(row2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With