是否可以使用datagridviewimagecolumn中的图像设置大小写?
Example:
If current row image = "Red.png"... show error msg
If current row image = "Green.png"... Insert to database谢谢!
发布于 2011-04-12 12:59:28
您可以通过这种方式来实现这一点
添加图像时,需要指定文本以标识您在DataGridViewImageCell,中显示的图像,只需设置单元格的描述
(dataGridView1[2, 2] as DataGridViewImageCell).Description = "Red";// Or Green然后,当您遍历时,只需检查imagecell的描述并执行您的操作
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if(row.Cells[2] is DataGridViewImageCell)
{
if((row.Cells[2] as DataGridViewImageCell).Description == "Red")
{ // your stuff}
}
}https://stackoverflow.com/questions/5629939
复制相似问题