I have a datagridview which has 2 columns, one is the name of the file and the other one is a column that has image that could have a red or green image.
I want to know how could I get the value to know which image is displayed in the datagridview column as follow:
Note: By Default is red, but it will change to green once you do something with that file.
How I added those images was with a image list as follow:
ImageList icons = new ImageList();
icons.Images.Add(Image.FromFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
"..\\..\\images", "red.png")));
icons.Images.Add(Image.FromFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
"..\\..\\images", "green.png")));
and are loaded to the datagridview as follow:
foreach (string file in Directory.GetFiles(
Path.Combine(DataBaseConfiguration.WPRPath, "CR" + _number)))
{
if (!file.Contains("~$"))
{
dgvWprFiles.Rows.Add(new object[] { Path.GetFileName(file), icons.Images[0] });
}
}
Well, the exactly question is: how to know when the column has red or green image?
thanks.
Those green and red images are most likely representing a Boolean value. You should be working with that Boolean value, not trying to re-verse engineer it via the image!
Unless you are doing screen scraping/atomation, you should not care what image is dispalyed. That is a minor detail of the Display side. And if you are doing screen scraping then the question should be rewored accordingly.
It would help a ton if you told us wich .NET Display technology you are a using. Even how you display a boolean as a iamge can varry greatly between those, and so does the answer.