Is it possible to display images and icons in this control?
M Mona Jul 21, 2005 #2 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]
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]
G Guest Jul 21, 2005 #3 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? Click to expand... Click to expand...
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? Click to expand... Click to expand...
G Guest Jul 22, 2005 #4 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? Click to expand... Click to expand... Click to expand...
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? Click to expand... Click to expand... Click to expand...