从数据库中取出一个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

posted on 2005-07-07 19:53  马维拉的真实之眼  阅读(902)  评论(1编辑  收藏  举报

导航