Hi -
I have a wingrid in which I'm displaying information about documents. One of the columns in the grid is bound to the file system path of the document, and on the InitializeRow event of the grid I'm adding an icon image to the cell if the document path is not null:
e.Row.Cells[c_ImageLocation].Appearance.Image = Image.FromFile(@"icon.pdf.png");
The icon appears in the cell at runtime just fine, but when I click on the icon the text value of the cell is highlighted and displayed, and I don't want that. I want to be able to reference the underlying text in order to send that path value to the code to open the document, but I don't want the text to appear to the user.
I've tried a few things to fake it out (font size and color, etc.), but it still shows up.
Is there a better/easier way to do what I'm trying to do?
thanks!
Hi,
What I would do is use the InitializeLayout event of the grid to hide the column that contains the filename. Then, add an unbound column and set it's DataType to Bitmap.
In the InitializeRow event, instead of setting the Appearance on this unbound column, you set the Value of the cell to your image.
This provides you with a column that just has an image in it and no text.
well - how would delete the image (set it to null) again?
I've tried to do something like:
row.Cells[my_Image_Cell_key].Value = null;
but this will raise an exception as "null" cannot interpreted as bitmap.