How set image to data grid view cell after data binding?

后端 未结 1 1522
予麋鹿
予麋鹿 2021-01-13 04:31

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

this is my code:

                DataTable tab = conn.searchData(searchTmp);
           


        
相关标签:
1条回答
  • 2021-01-13 04:48
      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;
      }
    
    0 讨论(0)
提交回复
热议问题