a d*_*a d 5 c# datagridview bitmap winforms
我有一个包含5列的完整dataGridView.
现在,我想在这些列的某些单元格中绘制一个位图.
它应该是这样的:

我目前试过:
dataGridView1.Rows.Add( ) ;
Run Code Online (Sandbox Code Playgroud)
你能帮我在dataGridView.Rows的新行中绘制一个位图吗?
尝试这个:
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);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2435 次 |
| 最近记录: |