从数据库中取出一个image图片,获得其缩略图,插入一个C1Flexgrid的单元格中

 
 1object opic=dataView[i]["样图"];
 2Byte[] bytePicture =(Byte[])opic;
 3MemoryStream ms = new MemoryStream bytePicture);
 4Bitmap bit = new Bitmap(ms);
 5Image smallbit;
 6Image smallbit=bit.GetThumbnailImage(100,100,null,IntPtr.Zero);//dataView[i]["样图"]  对应于sqlserver数据库中的一个Image字段内容
 7
 8
 9//设置C1flexgrid单元格尺寸
10CellRange cr = c1Grid.GetCellRange(i+1,j+1,i+1,j+1);
11cr.Image=smallbit;
12c1Grid.Rows[i+1].Height = smallbit.Height;
13c1Grid.Cols[j+1].Width = smallbit.Width;
14
原文地址:https://www.cnblogs.com/telephoner/p/188090.html