Showing a bitmap in dataGridView using C#

后端 未结 2 1009
后悔当初
后悔当初 2020-12-19 17:20

I want to show in dataGridView some image. I have two components, dataGridView, dataTable and one Bitmap. DataTable has two columns.

dataGridview.source = d         


        
2条回答
  •  半阙折子戏
    2020-12-19 18:21

    Simply create datatable with image column and add image to it

    dtMain.Columns.Add("ImageColumn", typeof(Image));
    dtMain.Rows.Add(Image.FromFile(photopath + "1.jpg"));
    

    Download full code at http://tablegridview.blogspot.in

提交回复
热议问题