How to set an image in a data grid view cell after data binding?

I have a problem adding an image to a DGV cell after data binding.

this is my code:

DataTable tab = conn.searchData(searchTmp); bindingSource1.DataSource = tab; DGV.AllowUserToAddRows = false; DGV.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader); //dont show this colls DGV.Columns["zId"].Visible = false; DGV.Columns["tId"].Visible = false; DGV.Columns["tId2"].Visible = false; DataGridViewImageColumn co = new DataGridViewImageColumn(); System.Reflection.Assembly thisExe; thisExe = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.Stream file = thisExe.GetManifestResourceStream("MyApp.Resources.Tx1[k].gif"); System.IO.Stream file2 = thisExe.GetManifestResourceStream("MyApp.Resources.Tx2[k].gif"); 

// and others for all columns - the first gray line

  Bitmap bmp = new Bitmap(file); co.Image = bmp; DataGridViewImageColumn img = new DataGridViewImageColumn(); Image image = bmp; img.Image = image; DGV.Columns.Add(img); img.HeaderText = "Image"; img.Name = "img"; 

The data table is the result from the databases, in the first coll I have a TeX expression - I want to generate images for this expression using "MimeTex.dll", I know how to do this, but I don't know how to replace this TeX expression with picture,
on the screen my raw DGV, no image.

on the last six lines I have some code to add a new column, because I am testing and trying how to replace the text of the columns of the first row (header row) with static images from application resources without success ...

Any idea? TIA screen: http://www.freeimagehosting.net/image.php?66fe2964fe.jpg

+4
source share
1 answer
  DataGridViewImageColumn ic= new DataGridViewImageColumn(); ic.HeaderText = "Img"; ic.Image = null; ic.Name = "cImg"; ic.Width = 100; DGV.Columns.Add(ic); foreach (DataGridViewRow row in DGV.Rows) { DataGridViewImageCell cell = row.Cells[1] as DataGridViewImageCell; cell.Value = (System.Drawing.Image)Properties.Resources.Icon_delete; } 
+9
source

All Articles