Hi
I'm using the clipboard to hold bmp's temporarily. There's gotta be a better way to hold pics in memory and then retrieve them. Could anyone educate me on how to do this?
Joey O.
Printable View
Hi
I'm using the clipboard to hold bmp's temporarily. There's gotta be a better way to hold pics in memory and then retrieve them. Could anyone educate me on how to do this?
Joey O.
Just use Loadpicture(filename as string)
It loads the image into memory and returns the handle for the image.
here'a an example:
h as long
h=loadpicture("C:\picture.bmp")' the picture is loaded
' and you have the handle 'h'
'Now to use the image
picture1.picture=h
Hope this helps,
-EnZedVBer
I'm not sure if you have to declare it "As Long" or "As New STDPicture" (I think that's the name). If it doesn't work, just don't declare it as Variant and it should work (I think) :)
HI
Thanks but I don't want to use files at all. I've been selecting portions of bmp's and using paintpicture function to send them to clipboard. I'd much rather just get the handle so I can load into an array.
I'll re-phrase the question:
How can I give the left, top, height, and width of any section of a bmp a handle that will persist untill I destroy it (and how do I destroy it)?
Basically, you wanna have something like a picturebox's Picture property, but without a picturebox, right?
Yes, but I would like that property to be able to hold an array of bmp formatted sections dictated by the user at runtime.
I've got no problem redimming or any of that stuff, I just don't know how to take a section of a picture outlined by say line (200,200)-(800,800),,B and get a handle on it without writing it to the clipboard or to a physical file.
Hum, you could use PaintPicture to paint a section of a picture into another picture :)
If you wanna know how to create a picture like a variable, you'll have to wait a bit... I think it's like "Dim A As New Bitmap" but I'm sure that's not the real name...
Yes! Please stay in touch. That is what I want to do. I want to hold sections of my bmps within variables!
I still want to know how to get the handle of the current bmp in a picturebox too though.
The handle is the .hDc property. But why do you need that? It's only used with BitBlt and stuff like that :)
I'm not 100% sure, but this might work:
VB Code:
Dim A As StdPicture Set A = 'Here you can have either LoadPicture() or a picture property
The only problem is that I can paint to it, but not resize it. And I can't make it just have a blank image :(
Maybe you should just keep the coordinates of the part of the image you're interested in, and paint from those coords whenever you need to. It would be much easier :)