是否可以使用datagridviewimagecolumn中存在的图像来设置IF大小写?if子句在datagridviewimagecolumn中使用图像
Example:
If current row image = "Red.png"... show error msg
If current row image = "Green.png"... Insert to database
谢谢!
是否可以使用datagridviewimagecolumn中存在的图像来设置IF大小写?if子句在datagridviewimagecolumn中使用图像
Example:
If current row image = "Red.png"... show error msg
If current row image = "Green.png"... Insert to database
谢谢!
可以以这种方式实现这一
需要分配一个文本识别您在DataGridViewImageCell正在显示图像,同时加入了图像只设置了电池
(dataGridView1[2, 2] as DataGridViewImageCell).Description = "Red";// Or Green
说明
然后,当你通过循环检查的图像单元的描述,并做你的东西
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if(row.Cells[2] is DataGridViewImageCell)
{
if((row.Cells[2] as DataGridViewImageCell).Description == "Red")
{ // your stuff}
}
}
yes ..”.description“...谢谢:) – huhooh30 2011-04-12 05:56:45
很高兴我能帮到你 – V4Vendetta 2011-04-12 06:18:37
需要更多信息..当前行图像是什么意思?是否当前选定的行包含图像? – xscape 2011-04-12 03:17:00
例如,Datagridview包含2列。 1st - >电子邮件第2次 - >图像显示电子邮件是否有效(Red.png为无效,Green.png为有效)当用户点击提交时,我将通过图像列,如果显示的图像是“红色.png“,将通知用户它再次失效,并且不允许他继续... – huhooh30 2011-04-12 03:45:31
使用”DGV.item(1,x).value = system.drawing.image将图像添加到DGV中.fromfile(strPath&“red.png”)“ – huhooh30 2011-04-12 03:54:54