我有一块田地DataGridViewImageColumn
,对于字段的每一行,根据条件,我添加不同的图像。有人知道我如何在 Windows 窗体中执行此操作吗?
if (dgvAndon.Rows[e.RowIndex].Cells["urgencyOrder"].ToString() == "1")
{
//Here I want to add the image in the image property field DataGridViewImageColumn.
}
- 将图像添加到属性文件夹下的 Resources.resx 中。 (例如 Picture1.jpeg)
- Add a
DataGridViewImageColumn
在你的DataGridView
-
这样添加图像:
for (int row = 0; row <= [YourDataGridViewName].Rows.Count - 1; row++)
{
((DataGridViewImageCell)gvFiles.Rows[row].Cells[1]).Value = Properties.Resources.Picture1
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)