DataGridView

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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?
 
Back
Top