从数据库添加图像到imagelist。 [英] Adding image to imagelist from database.

查看:72
本文介绍了从数据库添加图像到imagelist。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我在将图像从数据库添加到图像列表时出现问题,以下是我使用的代码,它会返回一个图像,但是当添加到图像列表时,图像会全部搞砸,因此无法显示。



Hi I'm having issues with adding an image from database to imagelist, the following is the code I use, it returns an image, but when added to image list the image gets all screwed up so it doesn't show.

'Load the image into a byte array
ImageArray = CType(dbrdr("COMP_PICTURE"), Byte())
'Create Memory Stream from Byte Array
Dim ms As New System.IO.MemoryStream(ImageArray)
'Add the memory stream to the image list
Dim img As System.Drawing.Image
img = Image.FromStream(ms)
ms.Close()
ilComponentImages.Images.Add(dbrdr("COMP_ID"), img)
ImageIndex = ilComponentImages.Images.IndexOfKey(dbrdr("COMP_ID"))





任何帮助表示



Any help appreciated

推荐答案

您如何确定图像已经搞砸了?怎么搞砸了?是图像对图像列表的位深度太高了吗?我们需要进一步澄清。
How are you sure the image is not screwed up already ? How is it screwed up ? Is it that the image has too high a bit depth for the image list ? Some clarity is needed for us to comment further.


如何从DAATA BASE添加IMAGELIST中的图像
HOW TO ADD IMAGES IN IMAGELIST FROM DAATA BASE


这篇关于从数据库添加图像到imagelist。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆