简体   繁体   English

VB6中来自数据库的图像控制

[英]Image control from Database in VB6

I have some images stored in a database and I want to populate an image control. 我有一些图像存储在数据库中,我想填充图像控件。 All the examples I can find copy the image to the hdd and then use loadpicture to put it in the image control. 我可以找到的所有示例都将图像复制到HDD,然后使用loadpicture将其放入图像控件中。 Is there a way to push the image directly in without going to the hdd first? 有没有办法直接将图像推入而无需先进入硬盘?

Here's some sample code that should get you there fairly easily: 以下是一些示例代码,可以使您轻松地到达那里:

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=29004&lngWId=1 http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=29004&lngWId=1

This assumes you have the image in a byte array. 假定您的图像位于字节数组中。 You can use standard DB functions to get your image out and into a byte array. 您可以使用标准的DB函数将图像输出到字节数组中。

If the database holds the image in typical serialized form (as it would exist in a file) then you can use WIA 2.0 to load the retrieved Byte array and produce a StdPicture object you can assign to the Image control's Picture property. 如果数据库以典型的序列化形式保存图像(因为该图像将存在于文件中),则可以使用WIA 2.0加载检索到的Byte数组并生成一个StdPicture对象,可以将其分配给Image控件的Picture属性。

Windows® Image Acquisition Automation Library v2.0 Tool: Image acquisition and manipulation component for VB and scripting Windows®图像采集自动化库v2.0工具:用于VB和脚本的图像采集和处理组件

This can handle PNG and TIFF as well as the usual suspects (GIF, JPEG, BMP). 这可以处理PNG和TIFF以及常见的可疑对象(GIF,JPEG,BMP)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM