DataGridView

G

Guest

Yes this helps - however when I implement the suggested code I get the class
name rather than the image displayed in the cell

Bitmap MyImage = new Bitmap("pic1.bmp");
if (e.ColumnIndex == 0)
{
e.Value = MyImage;
}
Displays "System.Drawing.Bitmap" rather than the actual image


Mona said:
Hi Tony,

For this, you can either use ImageColumns in the DataGridView as suggested
in the following link:

http://msdn2.microsoft.com/library/x0tz73t0(en-us,vs.80).aspx

or implement a handler for CellFormatting event of DataGridView control as
shown in the example in the following article:

http://msdn2.microsoft.com/library/z1cc356h(en-us,vs.80).aspx

Hope this helps.
Thanks
Mona [GrapeCity]
Tony said:
Is it possible to display images and icons in this control?
 
G

Guest

You have to make sure the "ColumnStyle" is set correctly, or it will just
call ToString() as in your example

Tony said:
Yes this helps - however when I implement the suggested code I get the class
name rather than the image displayed in the cell

Bitmap MyImage = new Bitmap("pic1.bmp");
if (e.ColumnIndex == 0)
{
e.Value = MyImage;
}
Displays "System.Drawing.Bitmap" rather than the actual image


Mona said:
Hi Tony,

For this, you can either use ImageColumns in the DataGridView as suggested
in the following link:

http://msdn2.microsoft.com/library/x0tz73t0(en-us,vs.80).aspx

or implement a handler for CellFormatting event of DataGridView control as
shown in the example in the following article:

http://msdn2.microsoft.com/library/z1cc356h(en-us,vs.80).aspx

Hope this helps.
Thanks
Mona [GrapeCity]
Tony said:
Is it possible to display images and icons in this control?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top