I'm trying to set images in a bound DataGridView image column. My enum has
three possible values, and I have an image that I want to show for each
value:
EnumValue.OK --GreenLight.gif
EnumValue.Caution --YellowLight.gif
EnumValue.Violation --RedLight.gif
I want to display the graphic, instead of the enum value, in each row of the
grid.
I tried to do this using the DataGridView CellFormatting event. I tried
taking the enum value from the cell Formatting event args (the e.Value
property), testing its value, then putting the appropriate image into the
e.Value property to display in the cell.
It's not working, because the DataGridView column is an image column and
won't take the enum value.
Here is what I'm trying to figure out:
(1) Am I going about this in the best way, or is there a different approach
that would work better? What would be involved in implementing it?
(2) If the CellFormatting event approach is viable, what do I need to do to
make it work?
Any and all suggestions appreciated. Thanks in advance.
--
David Veeneman
Foresight Systems