简体   繁体   中英

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. 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

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.

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.

Windows® Image Acquisition Automation Library v2.0 Tool: Image acquisition and manipulation component for VB and scripting

This can handle PNG and TIFF as well as the usual suspects (GIF, JPEG, BMP).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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